Skip to content

Commit d17468c

Browse files
committed
Merge tag 'riscv-for-linus-6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Palmer Dabbelt: - detect ".option arch" support on not-yet-released LLVM builds - fix missing TLB flush when modifying non-leaf PTEs - fixes for T-Head custom extensions - fix for systems with the legacy PMU, that manifests as a crash on kernels built without SBI PMU support - fix for systems that clear *envcfg on suspend, which manifests as cbo.zero trapping after resume - fixes for Svnapot systems, including removing Svnapot support for huge vmalloc/vmap regions * tag 'riscv-for-linus-6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: Sparse-Memory/vmemmap out-of-bounds fix riscv: Fix pte_leaf_size() for NAPOT Revert "riscv: mm: support Svnapot in huge vmap" riscv: Save/restore envcfg CSR during CPU suspend riscv: Add a custom ISA extension for the [ms]envcfg CSR riscv: Fix enabling cbo.zero when running in M-mode perf: RISCV: Fix panic on pmu overflow handler MAINTAINERS: Update SiFive driver maintainers drivers: perf: ctr_get_width function for legacy is not defined drivers: perf: added capabilities for legacy PMU RISC-V: Ignore V from the riscv,isa DT property on older T-Head CPUs riscv: Fix build error if !CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION riscv: mm: fix NOCACHE_THEAD does not set bit[61] correctly riscv: add CALLER_ADDRx support RISC-V: Drop invalid test from CONFIG_AS_HAS_OPTION_ARCH kbuild: Add -Wa,--fatal-warnings to as-instr invocation riscv: tlb: fix __p*d_free_tlb()
2 parents 5870ba3 + a11dd49 commit d17468c

21 files changed

+145
-113
lines changed

MAINTAINERS

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,7 @@ F: drivers/hwmon/max31760.c
13951395

13961396
ANALOGBITS PLL LIBRARIES
13971397
M: Paul Walmsley <paul.walmsley@sifive.com>
1398+
M: Samuel Holland <samuel.holland@sifive.com>
13981399
S: Supported
13991400
F: drivers/clk/analogbits/*
14001401
F: include/linux/clk/analogbits*
@@ -16743,6 +16744,7 @@ F: drivers/pci/controller/dwc/*layerscape*
1674316744
PCI DRIVER FOR FU740
1674416745
M: Paul Walmsley <paul.walmsley@sifive.com>
1674516746
M: Greentime Hu <greentime.hu@sifive.com>
16747+
M: Samuel Holland <samuel.holland@sifive.com>
1674616748
L: linux-pci@vger.kernel.org
1674716749
S: Maintained
1674816750
F: Documentation/devicetree/bindings/pci/sifive,fu740-pcie.yaml
@@ -19988,36 +19990,15 @@ S: Maintained
1998819990
F: drivers/watchdog/simatic-ipc-wdt.c
1998919991

1999019992
SIFIVE DRIVERS
19991-
M: Palmer Dabbelt <palmer@dabbelt.com>
1999219993
M: Paul Walmsley <paul.walmsley@sifive.com>
19994+
M: Samuel Holland <samuel.holland@sifive.com>
1999319995
L: linux-riscv@lists.infradead.org
1999419996
S: Supported
19997+
F: drivers/dma/sf-pdma/
1999519998
N: sifive
19999+
K: fu[57]40
1999620000
K: [^@]sifive
1999720001

19998-
SIFIVE CACHE DRIVER
19999-
M: Conor Dooley <conor@kernel.org>
20000-
L: linux-riscv@lists.infradead.org
20001-
S: Maintained
20002-
F: Documentation/devicetree/bindings/cache/sifive,ccache0.yaml
20003-
F: drivers/cache/sifive_ccache.c
20004-
20005-
SIFIVE FU540 SYSTEM-ON-CHIP
20006-
M: Paul Walmsley <paul.walmsley@sifive.com>
20007-
M: Palmer Dabbelt <palmer@dabbelt.com>
20008-
L: linux-riscv@lists.infradead.org
20009-
S: Supported
20010-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
20011-
N: fu540
20012-
K: fu540
20013-
20014-
SIFIVE PDMA DRIVER
20015-
M: Green Wan <green.wan@sifive.com>
20016-
S: Maintained
20017-
F: Documentation/devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml
20018-
F: drivers/dma/sf-pdma/
20019-
20020-
2002120002
SILEAD TOUCHSCREEN DRIVER
2002220003
M: Hans de Goede <hdegoede@redhat.com>
2002320004
L: linux-input@vger.kernel.org

arch/riscv/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ config AS_HAS_OPTION_ARCH
315315
# https://reviews.llvm.org/D123515
316316
def_bool y
317317
depends on $(as-instr, .option arch$(comma) +m)
318-
depends on !$(as-instr, .option arch$(comma) -i)
319318

320319
source "arch/riscv/Kconfig.socs"
321320
source "arch/riscv/Kconfig.errata"

arch/riscv/include/asm/csr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@
424424
# define CSR_STATUS CSR_MSTATUS
425425
# define CSR_IE CSR_MIE
426426
# define CSR_TVEC CSR_MTVEC
427+
# define CSR_ENVCFG CSR_MENVCFG
427428
# define CSR_SCRATCH CSR_MSCRATCH
428429
# define CSR_EPC CSR_MEPC
429430
# define CSR_CAUSE CSR_MCAUSE
@@ -448,6 +449,7 @@
448449
# define CSR_STATUS CSR_SSTATUS
449450
# define CSR_IE CSR_SIE
450451
# define CSR_TVEC CSR_STVEC
452+
# define CSR_ENVCFG CSR_SENVCFG
451453
# define CSR_SCRATCH CSR_SSCRATCH
452454
# define CSR_EPC CSR_SEPC
453455
# define CSR_CAUSE CSR_SCAUSE

arch/riscv/include/asm/ftrace.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
#define ARCH_SUPPORTS_FTRACE_OPS 1
2727
#ifndef __ASSEMBLY__
28+
29+
extern void *return_address(unsigned int level);
30+
31+
#define ftrace_return_address(n) return_address(n)
32+
2833
void MCOUNT_NAME(void);
2934
static inline unsigned long ftrace_call_adjust(unsigned long addr)
3035
{

arch/riscv/include/asm/hugetlb.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ static inline void arch_clear_hugepage_flags(struct page *page)
1111
}
1212
#define arch_clear_hugepage_flags arch_clear_hugepage_flags
1313

14+
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
1415
bool arch_hugetlb_migration_supported(struct hstate *h);
1516
#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
17+
#endif
1618

1719
#ifdef CONFIG_RISCV_ISA_SVNAPOT
1820
#define __HAVE_ARCH_HUGE_PTE_CLEAR

arch/riscv/include/asm/hwcap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
#define RISCV_ISA_EXT_ZTSO 72
8282
#define RISCV_ISA_EXT_ZACAS 73
8383

84+
#define RISCV_ISA_EXT_XLINUXENVCFG 127
85+
8486
#define RISCV_ISA_EXT_MAX 128
8587
#define RISCV_ISA_EXT_INVALID U32_MAX
8688

arch/riscv/include/asm/pgalloc.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
9595
__pud_free(mm, pud);
9696
}
9797

98-
#define __pud_free_tlb(tlb, pud, addr) pud_free((tlb)->mm, pud)
98+
#define __pud_free_tlb(tlb, pud, addr) \
99+
do { \
100+
if (pgtable_l4_enabled) { \
101+
pagetable_pud_dtor(virt_to_ptdesc(pud)); \
102+
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \
103+
} \
104+
} while (0)
99105

100106
#define p4d_alloc_one p4d_alloc_one
101107
static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr)
@@ -124,7 +130,11 @@ static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d)
124130
__p4d_free(mm, p4d);
125131
}
126132

127-
#define __p4d_free_tlb(tlb, p4d, addr) p4d_free((tlb)->mm, p4d)
133+
#define __p4d_free_tlb(tlb, p4d, addr) \
134+
do { \
135+
if (pgtable_l5_enabled) \
136+
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(p4d)); \
137+
} while (0)
128138
#endif /* __PAGETABLE_PMD_FOLDED */
129139

130140
static inline void sync_kernel_mappings(pgd_t *pgd)
@@ -149,7 +159,11 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
149159

150160
#ifndef __PAGETABLE_PMD_FOLDED
151161

152-
#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
162+
#define __pmd_free_tlb(tlb, pmd, addr) \
163+
do { \
164+
pagetable_pmd_dtor(virt_to_ptdesc(pmd)); \
165+
tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \
166+
} while (0)
153167

154168
#endif /* __PAGETABLE_PMD_FOLDED */
155169

arch/riscv/include/asm/pgtable-64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ enum napot_cont_order {
136136
* 10010 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Shareable, Non-trustable
137137
*/
138138
#define _PAGE_PMA_THEAD ((1UL << 62) | (1UL << 61) | (1UL << 60))
139-
#define _PAGE_NOCACHE_THEAD ((1UL < 61) | (1UL << 60))
139+
#define _PAGE_NOCACHE_THEAD ((1UL << 61) | (1UL << 60))
140140
#define _PAGE_IO_THEAD ((1UL << 63) | (1UL << 60))
141141
#define _PAGE_MTMASK_THEAD (_PAGE_PMA_THEAD | _PAGE_IO_THEAD | (1UL << 59))
142142

arch/riscv/include/asm/pgtable.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
* Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel
8585
* is configured with CONFIG_SPARSEMEM_VMEMMAP enabled.
8686
*/
87-
#define vmemmap ((struct page *)VMEMMAP_START)
87+
#define vmemmap ((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT))
8888

8989
#define PCI_IO_SIZE SZ_16M
9090
#define PCI_IO_END VMEMMAP_START
@@ -439,6 +439,10 @@ static inline pte_t pte_mkhuge(pte_t pte)
439439
return pte;
440440
}
441441

442+
#define pte_leaf_size(pte) (pte_napot(pte) ? \
443+
napot_cont_size(napot_cont_order(pte)) :\
444+
PAGE_SIZE)
445+
442446
#ifdef CONFIG_NUMA_BALANCING
443447
/*
444448
* See the comment in include/asm-generic/pgtable.h

arch/riscv/include/asm/suspend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct suspend_context {
1414
struct pt_regs regs;
1515
/* Saved and restored by high-level functions */
1616
unsigned long scratch;
17+
unsigned long envcfg;
1718
unsigned long tvec;
1819
unsigned long ie;
1920
#ifdef CONFIG_MMU

0 commit comments

Comments
 (0)