Re: [PATCH v9 5/7] powerpc/tlb: Add local flush for page given mm_struct and psize

2022-11-06 Thread Benjamin Gray
On Thu, 2022-11-03 at 11:39 +1100, Benjamin Gray wrote: > On Wed, 2022-11-02 at 09:56 +, Christophe Leroy wrote: > > By the way, 'extern' keyword is pointless and deprecated for > > functions > > prototypes, please don't add new ones, even if other historical > > prototypes have one. > >

[PATCH v2 3/4] powerpc/64e: Clear gprs on interrupt routine entry on Book3E

2022-11-06 Thread Rohan McLure
Zero GPRS r14-r31 on entry into the kernel for interrupt sources to limit influence of user-space values in potential speculation gadgets. Prior to this commit, all other GPRS are reassigned during the common prologue to interrupt handlers and so need not be zeroised explicitly. This may be done

[PATCH v2 4/4] powerpc/64s: Sanitise user registers on interrupt in pseries

2022-11-06 Thread Rohan McLure
Cause pseries platforms to default to zeroising all potentially user-defined registers when entering the kernel by means of any interrupt source, reducing user-influence of the kernel and the likelihood or producing speculation gadgets. Signed-off-by: Rohan McLure --- Resubmitting patches as

[PATCH v2 1/4] powerpc/64: Add INTERRUPT_SANITIZE_REGISTERS Kconfig

2022-11-06 Thread Rohan McLure
Add Kconfig option for enabling clearing of registers on arrival in an interrupt handler. This reduces the speculation influence of registers on kernel internals. The option will be consumed by 64-bit systems that feature speculation and wish to implement this mitigation. This patch only

[PATCH v2 2/4] powerpc/64s: Clear gprs on interrupt routine entry on Book3S

2022-11-06 Thread Rohan McLure
Zero user state in gprs (assign to zero) to reduce the influence of user registers on speculation within kernel syscall handlers. Clears occur at the very beginning of the sc and scv 0 interrupt handlers, with restores occurring following the execution of the syscall handler. Zero GPRS r0,

Re: [PATCH v4] i2c/pasemi: PASemi I2C controller IRQ enablement

2022-11-06 Thread Hector Martin
On 05/11/2022 20.56, Arminder Singh wrote: > This patch adds IRQ support to the PASemi I2C controller driver to > increase the performace of I2C transactions on platforms with PASemi I2C > controllers. While primarily intended for Apple silicon platforms, this > patch should also help in enabling

Re: [PATCH 44/44] KVM: Opt out of generic hardware enabling on s390 and PPC

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:50 AM Sean Christopherson wrote: > > Allow architectures to opt out of the generic hardware enabling logic, > and opt out on both s390 and PPC, which don't need to manually enable > virtualization as it's always on (when available). > > In addition to letting s390 and PPC

Re: [PATCH 30/44] KVM: Drop kvm_arch_check_processor_compat() hook

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:50 AM Sean Christopherson wrote: > > Drop kvm_arch_check_processor_compat() and its support code now that all > architecture implementations are nops. > > Signed-off-by: Sean Christopherson For KVM RISC-V: Acked-by: Anup Patel Thanks, Anup > --- >

Re: [PATCH 27/44] KVM: Drop kvm_arch_{init,exit}() hooks

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:50 AM Sean Christopherson wrote: > > Drop kvm_arch_init() and kvm_arch_exit() now that all implementations > are nops. > > No functional change intended. > > Signed-off-by: Sean Christopherson For KVM RISC-V: Acked-by: Anup Patel Thanks, Anup > --- >

Re: [PATCH 23/44] KVM: RISC-V: Tag init functions and data with __init, __ro_after_init

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:49 AM Sean Christopherson wrote: > > Now that KVM setup is handled directly in riscv_kvm_init(), tag functions > and data that are used/set only during init with __init/__ro_after_init. > > Signed-off-by: Sean Christopherson For KVM RISC-V: Acked-by: Anup Patel

Re: [PATCH 22/44] KVM: RISC-V: Do arch init directly in riscv_kvm_init()

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:49 AM Sean Christopherson wrote: > > Fold the guts of kvm_arch_init() into riscv_kvm_init() instead of > bouncing through kvm_init()=>kvm_arch_init(). Functionally, this is a > glorified nop as invoking kvm_arch_init() is the very first action > performed by kvm_init().

Re: [PATCH 09/44] KVM: Drop arch hardware (un)setup hooks

2022-11-06 Thread Anup Patel
On Thu, Nov 3, 2022 at 4:49 AM Sean Christopherson wrote: > > Drop kvm_arch_hardware_setup() and kvm_arch_hardware_unsetup() now that > all implementations are nops. > > No functional change intended. > > Signed-off-by: Sean Christopherson For KVM RISC-V: Acked-by: Anup Patel Thanks, Anup >

Re: [PATCH 2/4] powerpc/64s: Clear gprs on interrupt routine entry on Book3S

2022-11-06 Thread Russell Currey
On Thu, 2022-11-03 at 09:45 +1100, Rohan McLure wrote: > Zero user state in gprs (assign to zero) to reduce the influence of > user > registers on speculation within kernel syscall handlers. Clears occur > at the very beginning of the sc and scv 0 interrupt handlers, with > restores occurring

Re: [PATCH 1/4] powerpc: mm: Replace p{u,m,4}d_is_leaf with p{u,m,4}_leaf

2022-11-06 Thread Rohan McLure
> On 7 Nov 2022, at 9:49 am, Rohan McLure wrote: > > Replace occurrences of p{u,m,4}d_is_leaf with p{u,m,4}_leaf, as the > latter is the name given to checking that a higher-level entry in > multi-level paging contains a page translation entry (pte). This commit > allows for p{u,m,4}d_leaf to be

Re: [RFC PATCH 14/19] powerpc: split validate_sp into two functions

2022-11-06 Thread Russell Currey
On Mon, 2022-10-31 at 15:54 +1000, Nicholas Piggin wrote: > Most callers just want to validate an arbitrary kernel stack pointer, > some need a particular size. Make the size case the exceptional one > with an extra function. > > Signed-off-by: Nicholas Piggin > --- >  

Re: [RFC PATCH 4/6] powerpc/powernv: Convert pointers to physical addresses in OPAL call args

2022-11-06 Thread Russell Currey
On Sat, 2022-11-05 at 04:27 +1100, Andrew Donnellan wrote: > A number of OPAL calls take addresses as arguments (e.g. buffers with > strings to print, etc). These addresses need to be physical > addresses, as > OPAL runs in real mode. > > Since the hardware ignores the top two bits of the address

[PATCH 3/4] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-11-06 Thread Rohan McLure
Add the following helpers for detecting whether a page table entry is a leaf and is accessible to user space. * pte_user_accessible_page * pmd_user_accessible_page * pud_user_accessible_page Also implement missing pud_user definitions for both Book3S/nohash 64-bit systems, and pmd_user for

[PATCH 4/4] powerpc: mm: support page table check

2022-11-06 Thread Rohan McLure
On creation and clearing of a page table mapping, instrument such calls by invoking page_table_check_pte_set and page_table_check_pte_clear respectively. These calls serve as a sanity check against illegal mappings. Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK for all ppc64, and 32-bit platforms

[PATCH 1/4] powerpc: mm: Replace p{u,m,4}d_is_leaf with p{u,m,4}_leaf

2022-11-06 Thread Rohan McLure
Replace occurrences of p{u,m,4}d_is_leaf with p{u,m,4}_leaf, as the latter is the name given to checking that a higher-level entry in multi-level paging contains a page translation entry (pte). This commit allows for p{u,m,4}d_leaf to be used on all powerpc platforms. Prior to this commit, the

[PATCH 2/4] powerpc: mm: Add common pud_pfn stub for all platforms

2022-11-06 Thread Rohan McLure
Prior to this commit, pud_pfn was implemented with BUILD_BUG as the inline function for 64-bit Book3S systems but is never included, as its invocations in generic code are guarded by calls to pud_devmap which return zero on such systems. A future patch will provide support for page table checks,

Re: [PATCH v3 2/3] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-11-06 Thread Rohan McLure
> On 3 Nov 2022, at 7:02 pm, Christophe Leroy > wrote: > > > > Le 24/10/2022 à 02:35, Rohan McLure a écrit : >> Add the following helpers for detecting whether a page table entry >> is a leaf and is accessible to user space. >> >> * pte_user_accessible_page >> * pmd_user_accessible_page >>

[PATCH 4/4] powerpc/pseries: expose authenticated variables stored in LPAR PKS

2022-11-06 Thread Nayna Jain
PowerVM Guest Secure boot feature need to expose firmware managed secure variables for user management. These variables store keys for grub/kernel verification and also corresponding denied list. Expose these variables to the userpace via fwsecurityfs. Example: $ pwd

[PATCH 1/4] powerpc/pseries: Add new functions to PLPKS driver

2022-11-06 Thread Nayna Jain
PowerVM stores authenticated variables in the PowerVM LPAR Platform KeyStore(PLPKS). Add signed update H_CALL to PLPKS driver to support authenticated variables. Additionally, expose config values outside the PLPKS driver. Signed-off-by: Nayna Jain --- arch/powerpc/include/asm/hvcall.h |

[PATCH 3/4] powerpc/pseries: initialize fwsecurityfs with plpks arch-specific structure

2022-11-06 Thread Nayna Jain
PowerVM PLPKS variables are exposed via fwsecurityfs. Initialize fwsecurityfs arch-specific structure with plpks configuration. Eg: [root@ltcfleet35-lp1 config]# pwd /sys/firmware/security/plpks/config [root@ltcfleet35-lp1 config]# ls -ltrh total 0 -r--r--r-- 1 root root 1 Sep 28 15:01 version

[PATCH 2/4] fs: define a firmware security filesystem named fwsecurityfs

2022-11-06 Thread Nayna Jain
securityfs is meant for Linux security subsystems to expose policies/logs or any other information. However, there are various firmware security features which expose their variables for user management via the kernel. There is currently no single place to expose these variables. Different

[PATCH 0/4] powerpc/pseries: expose firmware security variables via filesystem

2022-11-06 Thread Nayna Jain
PowerVM provides an isolated Platform KeyStore (PKS)[1] storage allocation for each logical partition (LPAR) with individually managed access controls to store sensitive information securely. The Linux kernel can access this storage by interfacing with the hypervisor using a new set of hypervisor

[PATCH 6/6] powerpc/pseries: fix plpks_read_var() code for different consumers

2022-11-06 Thread Nayna Jain
Even though plpks_read_var() is currently called to read variables owned by different consumers, it internally supports only OS consumer. Fix plpks_read_var() to handle different consumers correctly. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by:

[PATCH 5/6] powerpc/pseries: replace kmalloc with kzalloc in PLPKS driver

2022-11-06 Thread Nayna Jain
Replace kmalloc with kzalloc in construct_auth() function to default initialize structure with zeroes. Signed-off-by: Nayna Jain --- arch/powerpc/platforms/pseries/plpks.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/pseries/plpks.c

[PATCH 4/6] powerpc/pseries: cleanup error logs in plpks driver

2022-11-06 Thread Nayna Jain
Logging H_CALL return codes in PLPKS driver are easy to confuse with Linux error codes. Let the caller of the function log the converted linux error code. Signed-off-by: Nayna Jain --- arch/powerpc/platforms/pseries/plpks.c | 10 -- 1 file changed, 10 deletions(-) diff --git

[PATCH 3/6] powerpc/pseries: Return -EIO instead of -EINTR for H_ABORTED error

2022-11-06 Thread Nayna Jain
Some commands for eg. "cat" might continue to retry on encountering EINTR. This is not expected for original error code H_ABORTED. Map H_ABORTED to more relevant Linux error code EIO. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Nayna Jain ---

[PATCH 2/6] powerpc/pseries: Fix the H_CALL error code in PLPKS driver

2022-11-06 Thread Nayna Jain
PAPR Spec defines H_P1 actually as H_PARAMETER and maps H_ABORTED to a different numerical value. Fix the error codes as per PAPR Specification. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Nayna Jain --- arch/powerpc/include/asm/hvcall.h | 3

[PATCH 0/6] powerpc/pseries - bugfixes/cleanups for PLPKS driver

2022-11-06 Thread Nayna Jain
This patchset fixes some bugs and does some cleanups. Nayna Jain (6): powerpc/pseries: fix the object owners enum value in plpks driver powerpc/pseries: Fix the H_CALL error code in PLPKS driver powerpc/pseries: Return -EIO instead of -EINTR for H_ABORTED error powerpc/pseries: cleanup

[PATCH 1/6] powerpc/pseries: fix the object owners enum value in plpks driver

2022-11-06 Thread Nayna Jain
OS_VAR_LINUX enum in PLPKS driver should be 0x02 instead of 0x01. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Nayna Jain --- arch/powerpc/platforms/pseries/plpks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH] macintosh: Fix warning comparing pointer to 0

2022-11-06 Thread Christophe Leroy
Le 06/11/2022 à 17:08, Christophe JAILLET a écrit : > Le 06/11/2022 à 16:18, wangkail...@jari.cn a écrit : >> Fix the following coccicheck warning: >> >> drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0. >> >> Signed-off-by: KaiLong Wang We already have such patches

Re: [PATCH] macintosh/adb: Fix warning comparing pointer to 0

2022-11-06 Thread Christophe Leroy
Le 06/11/2022 à 17:12, Christophe JAILLET a écrit : > Le 06/11/2022 à 16:28, wangkail...@jari.cn a écrit : >> Fix the following coccicheck warning: >> >> drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0. >> >> Signed-off-by: KaiLong Wang We already have such patches awaiting

Re: [PATCH] macintosh/adb: Fix warning comparing pointer to 0

2022-11-06 Thread Christophe JAILLET
Le 06/11/2022 à 16:28, wangkail...@jari.cn a écrit : Fix the following coccicheck warning: drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0. Signed-off-by: KaiLong Wang --- drivers/macintosh/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH] macintosh: Fix warning comparing pointer to 0

2022-11-06 Thread Christophe JAILLET
Le 06/11/2022 à 16:18, wangkail...@jari.cn a écrit : Fix the following coccicheck warning: drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0. Signed-off-by: KaiLong Wang --- drivers/macintosh/macio-adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [PATCH v4] i2c/pasemi: PASemi I2C controller IRQ enablement

2022-11-06 Thread Sven Peter
Hi, On Sat, Nov 5, 2022, at 12:56, Arminder Singh wrote: > This patch adds IRQ support to the PASemi I2C controller driver to > increase the performace of I2C transactions on platforms with PASemi I2C > controllers. While primarily intended for Apple silicon platforms, this > patch should also

[PATCH] macintosh/adb: Fix warning comparing pointer to 0

2022-11-06 Thread wangkailong
Fix the following coccicheck warning: drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0. Signed-off-by: KaiLong Wang --- drivers/macintosh/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index

[PATCH] macintosh: Fix warning comparing pointer to 0

2022-11-06 Thread wangkailong
Fix the following coccicheck warning: drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0. Signed-off-by: KaiLong Wang --- drivers/macintosh/macio-adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/macio-adb.c

Re: [PATCH v3] soc: fsl: qe: Add check for ioremap

2022-11-06 Thread Christophe Leroy
Le 11/10/2022 à 08:52, Jiasheng Jiang a écrit : > As ioremap can return NULL pointer, it should > be better to check the return value return error > if fails. > Moreover, the return value of qe_reset should be > checked by cascade. > > Fixes: 68f047e3d62e ("fsl/qe: add rx_sync and tx_sync for