Re: [PATCH v5 26/33] nios2: Convert __pte_free_tlb() to use ptdescs

2023-06-27 Thread Dinh Nguyen




On 6/27/23 16:01, Guenter Roeck wrote:

On 6/27/23 13:05, Dinh Nguyen wrote:



On 6/27/23 14:56, Vishal Moola wrote:
On Tue, Jun 27, 2023 at 12:14 PM Guenter Roeck  
wrote:


On 6/27/23 12:10, Guenter Roeck wrote:

On 6/27/23 10:42, Vishal Moola wrote:
On Mon, Jun 26, 2023 at 10:47 PM Guenter Roeck 
 wrote:


On Thu, Jun 22, 2023 at 01:57:38PM -0700, Vishal Moola (Oracle) 
wrote:
Part of the conversions to replace pgtable 
constructor/destructors with

ptdesc equivalents.

Signed-off-by: Vishal Moola (Oracle) 
Acked-by: Mike Rapoport (IBM) 


This patch causes all nios2 builds to fail.


It looks like you tried to apply this patch on its own. This patch 
depends
on patches 01-12 of this patchset to compile properly. I've 
cross-compiled

this architecture and it worked, but let me know if something fails
when its applied on top of those patches (or the rest of the 
patchset).



No, I did not try to apply this patch on its own. I tried to build 
yesterday's

pending-fixes branch of linux-next.



A quick check shows that the build fails with next-20230627. See log 
below.


Ah it looks like this one slipped into -next on its own somehow? 
Stephen, please

drop this patch from -next; it shouldn't be in without the rest of the
patchset which
I intend to have Andrew take through the mm tree.



I apologize, but I queue this patch up for Linus and it's been pulled 
for this merge window. I didn't realize you were going to take this 
patchset through another tree.


Sorry about that.



Yes, indeed, I just confirmed that all nios2 builds in the mainline kernel
are now broken.



Please let me know if you need to do anything. I'm going to out for a 
week starting tomorrow.


Dinh


Re: [PATCH v5 26/33] nios2: Convert __pte_free_tlb() to use ptdescs

2023-06-27 Thread Dinh Nguyen




On 6/27/23 14:56, Vishal Moola wrote:

On Tue, Jun 27, 2023 at 12:14 PM Guenter Roeck  wrote:


On 6/27/23 12:10, Guenter Roeck wrote:

On 6/27/23 10:42, Vishal Moola wrote:

On Mon, Jun 26, 2023 at 10:47 PM Guenter Roeck  wrote:


On Thu, Jun 22, 2023 at 01:57:38PM -0700, Vishal Moola (Oracle) wrote:

Part of the conversions to replace pgtable constructor/destructors with
ptdesc equivalents.

Signed-off-by: Vishal Moola (Oracle) 
Acked-by: Mike Rapoport (IBM) 


This patch causes all nios2 builds to fail.


It looks like you tried to apply this patch on its own. This patch depends
on patches 01-12 of this patchset to compile properly. I've cross-compiled
this architecture and it worked, but let me know if something fails
when its applied on top of those patches (or the rest of the patchset).



No, I did not try to apply this patch on its own. I tried to build yesterday's
pending-fixes branch of linux-next.



A quick check shows that the build fails with next-20230627. See log below.


Ah it looks like this one slipped into -next on its own somehow? Stephen, please
drop this patch from -next; it shouldn't be in without the rest of the
patchset which
I intend to have Andrew take through the mm tree.



I apologize, but I queue this patch up for Linus and it's been pulled 
for this merge window. I didn't realize you were going to take this 
patchset through another tree.


Sorry about that.

Dinh


Re: [PATCH v5 26/33] nios2: Convert __pte_free_tlb() to use ptdescs

2023-06-22 Thread Dinh Nguyen




On 6/22/23 15:57, Vishal Moola (Oracle) wrote:

Part of the conversions to replace pgtable constructor/destructors with
ptdesc equivalents.

Signed-off-by: Vishal Moola (Oracle) 
Acked-by: Mike Rapoport (IBM) 
---
  arch/nios2/include/asm/pgalloc.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
index ecd1657bb2ce..ce6bb8e74271 100644
--- a/arch/nios2/include/asm/pgalloc.h
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t 
*pmd,
  
  extern pgd_t *pgd_alloc(struct mm_struct *mm);
  
-#define __pte_free_tlb(tlb, pte, addr)\

-   do {\
-   pgtable_pte_page_dtor(pte); \
-   tlb_remove_page((tlb), (pte));  \
+#define __pte_free_tlb(tlb, pte, addr) \
+   do {\
+   pagetable_pte_dtor(page_ptdesc(pte));   \
+   tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte)));  \
} while (0)
  
  #endif /* _ASM_NIOS2_PGALLOC_H */


Acked-by: Dinh Nguyen 


Re: [PATCH v4 27/34] nios2: Convert __pte_free_tlb() to use ptdescs

2023-06-14 Thread Dinh Nguyen




On 6/14/23 04:30, Geert Uytterhoeven wrote:

Hi Dinh,

On Wed, Jun 14, 2023 at 12:17 AM Dinh Nguyen  wrote:

On 6/12/23 16:04, Vishal Moola (Oracle) wrote:

Part of the conversions to replace pgtable constructor/destructors with
ptdesc equivalents.

Signed-off-by: Vishal Moola (Oracle) 
---
   arch/nios2/include/asm/pgalloc.h | 8 
   1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
index ecd1657bb2ce..ce6bb8e74271 100644
--- a/arch/nios2/include/asm/pgalloc.h
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t 
*pmd,

   extern pgd_t *pgd_alloc(struct mm_struct *mm);

-#define __pte_free_tlb(tlb, pte, addr)   \
- do {\
- pgtable_pte_page_dtor(pte); \
- tlb_remove_page((tlb), (pte));  \
+#define __pte_free_tlb(tlb, pte, addr)   \
+ do {\
+ pagetable_pte_dtor(page_ptdesc(pte));   \
+ tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte)));  \
   } while (0)

   #endif /* _ASM_NIOS2_PGALLOC_H */


Applied!


I don't think you can just apply this patch, as the new functions
were only introduced in [PATCH v4 05/34] of this series.



Ah, thanks for the pointer!

Dinh


Re: [PATCH v4 27/34] nios2: Convert __pte_free_tlb() to use ptdescs

2023-06-13 Thread Dinh Nguyen




On 6/12/23 16:04, Vishal Moola (Oracle) wrote:

Part of the conversions to replace pgtable constructor/destructors with
ptdesc equivalents.

Signed-off-by: Vishal Moola (Oracle) 
---
  arch/nios2/include/asm/pgalloc.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
index ecd1657bb2ce..ce6bb8e74271 100644
--- a/arch/nios2/include/asm/pgalloc.h
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -28,10 +28,10 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t 
*pmd,
  
  extern pgd_t *pgd_alloc(struct mm_struct *mm);
  
-#define __pte_free_tlb(tlb, pte, addr)\

-   do {\
-   pgtable_pte_page_dtor(pte); \
-   tlb_remove_page((tlb), (pte));  \
+#define __pte_free_tlb(tlb, pte, addr) \
+   do {\
+   pagetable_pte_dtor(page_ptdesc(pte));   \
+   tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte)));  \
} while (0)
  
  #endif /* _ASM_NIOS2_PGALLOC_H */


Applied!

Thanks,
Dinh


Re: [PATCH 01/13] nios2: define virtual address space for modules

2023-06-13 Thread Dinh Nguyen




On 6/1/23 05:12, Mike Rapoport wrote:

From: "Mike Rapoport (IBM)" 

nios2 uses kmalloc() to implement module_alloc() because CALL26/PCREL26
cannot reach all of vmalloc address space.

Define module space as 32MiB below the kernel base and switch nios2 to
use vmalloc for module allocations.

Suggested-by: Thomas Gleixner 
Signed-off-by: Mike Rapoport (IBM) 
---
  arch/nios2/include/asm/pgtable.h |  5 -
  arch/nios2/kernel/module.c   | 19 ---
  2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
index 0f5c2564e9f5..0073b289c6a4 100644
--- a/arch/nios2/include/asm/pgtable.h
+++ b/arch/nios2/include/asm/pgtable.h
@@ -25,7 +25,10 @@
  #include 
  
  #define VMALLOC_START		CONFIG_NIOS2_KERNEL_MMU_REGION_BASE

-#define VMALLOC_END(CONFIG_NIOS2_KERNEL_REGION_BASE - 1)
+#define VMALLOC_END(CONFIG_NIOS2_KERNEL_REGION_BASE - SZ_32M - 1)
+
+#define MODULES_VADDR  (CONFIG_NIOS2_KERNEL_REGION_BASE - SZ_32M)
+#define MODULES_END(CONFIG_NIOS2_KERNEL_REGION_BASE - 1)
  
  struct mm_struct;
  
diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c

index 76e0a42d6e36..9c97b7513853 100644
--- a/arch/nios2/kernel/module.c
+++ b/arch/nios2/kernel/module.c
@@ -21,23 +21,12 @@
  
  #include 
  
-/*

- * Modules should NOT be allocated with kmalloc for (obvious) reasons.
- * But we do it for now to avoid relocation issues. CALL26/PCREL26 cannot reach
- * from 0x8000 (vmalloc area) to 0xc (kernel) (kmalloc returns
- * addresses in 0xc000)
- */
  void *module_alloc(unsigned long size)
  {
-   if (size == 0)
-   return NULL;
-   return kmalloc(size, GFP_KERNEL);
-}
-
-/* Free memory returned from module_alloc */
-void module_memfree(void *module_region)
-{
-   kfree(module_region);
+   return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
+   GFP_KERNEL, PAGE_KERNEL_EXEC,
+   VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
+   __builtin_return_address(0));
  }
  
  int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,


Acked-by: Dinh Nguyen 


Re: [PATCH 05/11] ARM: dts: socfpga: Fix pca9548 i2c-mux node name

2022-12-06 Thread Dinh Nguyen




On 12/2/22 10:49, Geert Uytterhoeven wrote:

"make dtbs_check":

 arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dtb: i2cswitch@70: 
$nodename:0: 'i2cswitch@70' does not match '^(i2c-?)?mux'
From schema: 
Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml
 arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dtb: i2cswitch@70: 
Unevaluated properties are not allowed ('#address-cells', '#size-cells', 
'i2c@0', 'i2c@1', 'i2c@2', 'i2c@3', 'i2c@4', 'i2c@5', 'i2c@6', 'i2c@7' were 
unexpected)
 From schema: Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml

Fix this by renaming the PCA9548 node to "i2c-mux", to match the I2C bus
multiplexer/switch DT bindings and the Generic Names Recommendation in
the Devicetree Specification.

Signed-off-by: Geert Uytterhoeven 
---
  arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts 
b/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts
index f24f17c2f5ee6bc4..e0630b0eed036d35 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts
@@ -141,7 +141,7 @@ at24@50 {
reg = <0x50>;
};
  
-	i2cswitch@70 {

+   i2c-mux@70 {
compatible = "nxp,pca9548";
#address-cells = <1>;
#size-cells = <0>;


Applied!

Thanks,
Dinh


Re: [PATCH V7 15/26] nios2/mm: Enable ARCH_HAS_VM_GET_PAGE_PROT

2022-07-11 Thread Dinh Nguyen




On 7/11/22 02:05, Anshuman Khandual wrote:

This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports standard
vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT, which looks
up a private and static protection_map[] array. Subsequently all __SXXX and
__PXXX macros can be dropped which are no longer needed.

Cc: Dinh Nguyen 
Cc: linux-ker...@vger.kernel.org
Signed-off-by: Anshuman Khandual 
---
  arch/nios2/Kconfig   |  1 +
  arch/nios2/include/asm/pgtable.h | 16 
  arch/nios2/mm/init.c | 20 
  3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 4167f1eb4cd8..e0459dffd218 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -6,6 +6,7 @@ config NIOS2
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
select ARCH_HAS_DMA_SET_UNCACHED
+   select ARCH_HAS_VM_GET_PAGE_PROT
select ARCH_NO_SWAP
select COMMON_CLK
select TIMER_OF
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
index 262d0609268c..470516d4555e 100644
--- a/arch/nios2/include/asm/pgtable.h
+++ b/arch/nios2/include/asm/pgtable.h
@@ -40,24 +40,8 @@ struct mm_struct;
   */
  
  /* Remove W bit on private pages for COW support */

-#define __P000 MKP(0, 0, 0)
-#define __P001 MKP(0, 0, 1)
-#define __P010 MKP(0, 0, 0)/* COW */
-#define __P011 MKP(0, 0, 1)/* COW */
-#define __P100 MKP(1, 0, 0)
-#define __P101 MKP(1, 0, 1)
-#define __P110 MKP(1, 0, 0)/* COW */
-#define __P111 MKP(1, 0, 1)/* COW */
  
  /* Shared pages can have exact HW mapping */

-#define __S000 MKP(0, 0, 0)
-#define __S001 MKP(0, 0, 1)
-#define __S010 MKP(0, 1, 0)
-#define __S011 MKP(0, 1, 1)
-#define __S100 MKP(1, 0, 0)
-#define __S101 MKP(1, 0, 1)
-#define __S110 MKP(1, 1, 0)
-#define __S111 MKP(1, 1, 1)
  
  /* Used all over the kernel */

  #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \
diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c
index 613fcaa5988a..ae24687d12ad 100644
--- a/arch/nios2/mm/init.c
+++ b/arch/nios2/mm/init.c
@@ -124,3 +124,23 @@ const char *arch_vma_name(struct vm_area_struct *vma)
  {
return (vma->vm_start == KUSER_BASE) ? "[kuser]" : NULL;
  }
+
+static const pgprot_t protection_map[16] = {
+   [VM_NONE]   = MKP(0, 0, 0),
+   [VM_READ]   = MKP(0, 0, 1),
+   [VM_WRITE]  = MKP(0, 0, 0),
+   [VM_WRITE | VM_READ]= MKP(0, 0, 1),
+   [VM_EXEC]   = MKP(1, 0, 0),
+   [VM_EXEC | VM_READ] = MKP(1, 0, 1),
+   [VM_EXEC | VM_WRITE]= MKP(1, 0, 0),
+   [VM_EXEC | VM_WRITE | VM_READ]  = MKP(1, 0, 1),
+   [VM_SHARED] = MKP(0, 0, 0),
+   [VM_SHARED | VM_READ]   = MKP(0, 0, 1),
+   [VM_SHARED | VM_WRITE]  = MKP(0, 1, 0),
+   [VM_SHARED | VM_WRITE | VM_READ]= MKP(0, 1, 1),
+   [VM_SHARED | VM_EXEC]   = MKP(1, 0, 0),
+   [VM_SHARED | VM_EXEC | VM_READ] = MKP(1, 0, 1),
+   [VM_SHARED | VM_EXEC | VM_WRITE]= MKP(1, 1, 0),
+   [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ]  = MKP(1, 1, 1)
+};
+DECLARE_VM_GET_PAGE_PROT


Acked-by: Dinh Nguyen 


Re: [PATCH v2 18/18] uaccess: drop maining CONFIG_SET_FS users

2022-02-24 Thread Dinh Nguyen




On 2/16/22 07:13, Arnd Bergmann wrote:

From: Arnd Bergmann 

There are no remaining callers of set_fs(), so CONFIG_SET_FS
can be removed globally, along with the thread_info field and
any references to it.

This turns access_ok() into a cheaper check against TASK_SIZE_MAX.

With CONFIG_SET_FS gone, so drop all remaining references to
set_fs()/get_fs(), mm_segment_t and uaccess_kernel().

Signed-off-by: Arnd Bergmann 
---
  arch/Kconfig  |  3 -
  arch/alpha/Kconfig|  1 -
  arch/alpha/include/asm/processor.h|  4 --
  arch/alpha/include/asm/thread_info.h  |  2 -
  arch/alpha/include/asm/uaccess.h  | 19 --
  arch/arc/Kconfig  |  1 -
  arch/arc/include/asm/segment.h| 20 ---
  arch/arc/include/asm/thread_info.h|  3 -
  arch/arc/include/asm/uaccess.h|  1 -
  arch/arm/lib/uaccess_with_memcpy.c| 10 
  arch/csky/Kconfig |  1 -
  arch/csky/include/asm/processor.h |  2 -
  arch/csky/include/asm/segment.h   | 10 
  arch/csky/include/asm/thread_info.h   |  2 -
  arch/csky/include/asm/uaccess.h   |  3 -
  arch/csky/kernel/asm-offsets.c|  1 -
  arch/h8300/Kconfig|  1 -
  arch/h8300/include/asm/processor.h|  1 -
  arch/h8300/include/asm/segment.h  | 40 -
  arch/h8300/include/asm/thread_info.h  |  3 -
  arch/h8300/kernel/entry.S |  1 -
  arch/h8300/kernel/head_ram.S  |  1 -
  arch/h8300/mm/init.c  |  6 --
  arch/h8300/mm/memory.c|  1 -
  arch/hexagon/Kconfig  |  1 -
  arch/hexagon/include/asm/thread_info.h|  6 --
  arch/hexagon/kernel/process.c |  1 -
  arch/microblaze/Kconfig   |  1 -
  arch/microblaze/include/asm/thread_info.h |  6 --
  arch/microblaze/include/asm/uaccess.h | 24 
  arch/microblaze/kernel/asm-offsets.c  |  1 -
  arch/microblaze/kernel/process.c  |  1 -
  arch/nds32/Kconfig|  1 -
  arch/nds32/include/asm/thread_info.h  |  4 --
  arch/nds32/include/asm/uaccess.h  | 15 +
  arch/nds32/kernel/process.c   |  5 +-
  arch/nds32/mm/alignment.c |  3 -
  arch/nios2/Kconfig|  1 -
  arch/nios2/include/asm/thread_info.h  |  9 ---
  arch/nios2/include/asm/uaccess.h  | 12 


For NIOS2:

Acked-by: Dinh Nguyen 


Re: [PATCH v2 13/18] uaccess: generalize access_ok()

2022-02-24 Thread Dinh Nguyen




On 2/16/22 07:13, Arnd Bergmann wrote:

From: Arnd Bergmann 

There are many different ways that access_ok() is defined across
architectures, but in the end, they all just compare against the
user_addr_max() value or they accept anything.

Provide one definition that works for most architectures, checking
against TASK_SIZE_MAX for user processes or skipping the check inside
of uaccess_kernel() sections.

For architectures without CONFIG_SET_FS(), this should be the fastest
check, as it comes down to a single comparison of a pointer against a
compile-time constant, while the architecture specific versions tend to
do something more complex for historic reasons or get something wrong.

Type checking for __user annotations is handled inconsistently across
architectures, but this is easily simplified as well by using an inline
function that takes a 'const void __user *' argument. A handful of
callers need an extra __user annotation for this.

Some architectures had trick to use 33-bit or 65-bit arithmetic on the
addresses to calculate the overflow, however this simpler version uses
fewer registers, which means it can produce better object code in the
end despite needing a second (statically predicted) branch.

Reviewed-by: Christoph Hellwig 
Acked-by: Mark Rutland  [arm64, asm-generic]
Signed-off-by: Arnd Bergmann 
---
  arch/Kconfig  |  7 
  arch/alpha/include/asm/uaccess.h  | 34 +++
  arch/arc/include/asm/uaccess.h| 29 -
  arch/arm/include/asm/uaccess.h| 20 +
  arch/arm64/include/asm/uaccess.h  | 11 ++---
  arch/csky/include/asm/uaccess.h   |  8 
  arch/hexagon/include/asm/uaccess.h| 25 
  arch/ia64/include/asm/uaccess.h   |  5 +--
  arch/m68k/Kconfig.cpu |  1 +
  arch/m68k/include/asm/uaccess.h   | 19 +
  arch/microblaze/include/asm/uaccess.h |  8 +---
  arch/mips/include/asm/uaccess.h   | 29 +
  arch/nds32/include/asm/uaccess.h  |  7 +---
  arch/nios2/include/asm/uaccess.h  | 11 +


Acked-by: Dinh Nguyen 


Re: [PATCH v2 12/18] uaccess: fix type mismatch warnings from access_ok()

2022-02-24 Thread Dinh Nguyen




On 2/16/22 07:13, Arnd Bergmann wrote:

From: Arnd Bergmann 

On some architectures, access_ok() does not do any argument type
checking, so replacing the definition with a generic one causes
a few warnings for harmless issues that were never caught before.

Fix the ones that I found either through my own test builds or
that were reported by the 0-day bot.

Reported-by: kernel test robot 
Signed-off-by: Arnd Bergmann 
---
  arch/arc/kernel/process.c   |  2 +-
  arch/arm/kernel/swp_emulate.c   |  2 +-
  arch/arm/kernel/traps.c |  2 +-
  arch/csky/kernel/signal.c   |  2 +-
  arch/mips/sibyte/common/sb_tbprof.c |  6 +++---
  arch/nios2/kernel/signal.c  | 20 +++-


Acked-by: Dinh Nguyen 


Re: [PATCH v2 02/18] uaccess: fix nios2 and microblaze get_user_8()

2022-02-24 Thread Dinh Nguyen
rr) do {			\

+extern void __get_user_unknown(void);
+
+#define __get_user_8(val, ptr, err) do {   \
+   u64 __val = 0;  \
err = 0;\
-   if (__copy_from_user(&(val), ptr, size)) {  \
+   if (raw_copy_from_user(&(__val), ptr, sizeof(val))) {   \
err = -EFAULT;  \
+   } else {\
+   val = (typeof(val))(typeof((val) - (val)))__val;\
}   \
} while (0)
  
@@ -119,8 +126,11 @@ do {	\

case 4: \
__get_user_asm(val, "ldw", ptr, err); \
break;  \
+   case 8: \
+   __get_user_8(val, ptr, err);\
+   break;  \
default:\
-   __get_user_unknown(val, size, ptr, err);\
+   __get_user_unknown();   \
break;  \
}   \
  } while (0)
@@ -129,9 +139,7 @@ do {
\
({  \
long __gu_err = -EFAULT;\
const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);  \
-   unsigned long __gu_val = 0; \
-   __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\
-   (x) = (__force __typeof__(x))__gu_val;  \
+   __get_user_common(x, sizeof(*(ptr)), __gu_ptr, __gu_err);   \
__gu_err;   \
})
  
@@ -139,11 +147,9 @@ do {	\

  ({\
long __gu_err = -EFAULT;\
const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);  \
-   unsigned long __gu_val = 0; \
if (access_ok( __gu_ptr, sizeof(*__gu_ptr)))\
-   __get_user_common(__gu_val, sizeof(*__gu_ptr),  \
+   __get_user_common(x, sizeof(*__gu_ptr), \
        __gu_ptr, __gu_err);\
-   (x) = (__force __typeof__(x))__gu_val;  \
__gu_err;   \
  })
  


Acked-by: Dinh Nguyen 


Re: [PATCH v2 07/18] nios2: drop access_ok() check from __put_user()

2022-02-24 Thread Dinh Nguyen
+   __put_user_common(__pu_val, __pu_ptr) : \
+   -EFAULT;        \
+})
  
  #endif /* _ASM_NIOS2_UACCESS_H */


Acked-by: Dinh Nguyen 


Re: [PATCH v2 12/34] dt-bindings: arm: Convert Altera board/soc bindings to json-schema

2018-12-05 Thread Dinh Nguyen



On 12/3/18 3:32 PM, Rob Herring wrote:
> Convert Altera SoC bindings to DT schema format using json-schema.
> 
> Cc: Mark Rutland 
> Cc: Dinh Nguyen 
> Cc: devicet...@vger.kernel.org
> Signed-off-by: Rob Herring 
> ---
>  .../devicetree/bindings/arm/altera.txt| 14 -
>  .../devicetree/bindings/arm/altera.yaml   | 20 +++
>  2 files changed, 20 insertions(+), 14 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/arm/altera.txt
>  create mode 100644 Documentation/devicetree/bindings/arm/altera.yaml
> 
> diff --git a/Documentation/devicetree/bindings/arm/altera.txt 
> b/Documentation/devicetree/bindings/arm/altera.txt
> deleted file mode 100644
> index 558735aacca8..
> --- a/Documentation/devicetree/bindings/arm/altera.txt
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -Altera's SoCFPGA platform device tree bindings
> --
> -
> -Boards with Cyclone 5 SoC:
> -Required root node properties:
> -compatible = "altr,socfpga-cyclone5", "altr,socfpga";
> -
> -Boards with Arria 5 SoC:
> -Required root node properties:
> -compatible = "altr,socfpga-arria5", "altr,socfpga";
> -
> -Boards with Arria 10 SoC:
> -Required root node properties:
> -compatible = "altr,socfpga-arria10", "altr,socfpga";
> diff --git a/Documentation/devicetree/bindings/arm/altera.yaml 
> b/Documentation/devicetree/bindings/arm/altera.yaml
> new file mode 100644
> index ..49e0362ddc11
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/altera.yaml
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/arm/altera.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Altera's SoCFPGA platform device tree bindings
> +
> +maintainers:
> +  - Dinh Nguyen 
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +- altr,socfpga-cyclone5
> +- altr,socfpga-arria5
> +- altr,socfpga-arria10
> +  - const: altr,socfpga
> +...
> 

Acked-by: Dinh Nguyen 


Re: [PATCH v2 04/34] dt-bindings: altera: Convert clkmgr binding to json-schema

2018-12-05 Thread Dinh Nguyen



On 12/3/18 3:31 PM, Rob Herring wrote:
> Convert Altera clkmgr to DT schema format using json-schema.
> 
> Cc: Mark Rutland 
> Cc: Dinh Nguyen 
> Cc: devicet...@vger.kernel.org
> Signed-off-by: Rob Herring 
> ---
>  .../arm/altera/socfpga-clk-manager.txt| 11 ---
>  .../arm/altera/socfpga-clk-manager.yaml   | 31 +++
>  2 files changed, 31 insertions(+), 11 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.txt
>  create mode 100644 
> Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.txt 
> b/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.txt
> deleted file mode 100644
> index 2c28f1d12f45..
> --- a/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.txt
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -Altera SOCFPGA Clock Manager
> -
> -Required properties:
> -- compatible : "altr,clk-mgr"
> -- reg : Should contain base address and length for Clock Manager
> -
> -Example:
> -  clkmgr@ffd04000 {
> - compatible = "altr,clk-mgr";
> - reg = <0xffd04000 0x1000>;
> - };
> diff --git 
> a/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml 
> b/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> new file mode 100644
> index ..e4131fa42b26
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/altera/socfpga-clk-manager.yaml
> @@ -0,0 +1,31 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/arm/altera/socfpga-clk-manager.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Altera SOCFPGA Clock Manager
> +
> +maintainers:
> +  - Dinh Nguyen 
> +
> +description: test
> +
> +properties:
> +  compatible:
> +items:
> +  - const: altr,clk-mgr
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +
> +examples:
> +  - |
> +clkmgr@ffd04000 {
> +  compatible = "altr,clk-mgr";
> +  reg = <0xffd04000 0x1000>;
> +};
> +
> +...
> 

Acked-by: Dinh Nguyen