[GIT PULL] Please pull powerpc/linux.git powerpc-5.15-3 tag

2021-10-10 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Linus,

Please pull some more powerpc fixes for 5.15.

A bit of a big batch, partly because I didn't send any last week, and also just 
because
the BPF fixes happened to land this week.

cheers


The following changes since commit e4e737bb5c170df6135a127739a9e6148ee3da82:

  Linux 5.15-rc2 (2021-09-19 17:28:22 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
tags/powerpc-5.15-3

for you to fetch changes up to eb8257a12192f43ffd41bd90932c39dade958042:

  pseries/eeh: Fix the kdump kernel crash during eeh_pseries_init (2021-10-07 
23:37:22 +1100)

- --
powerpc fixes for 5.15 #3

Fix a regression hit by the IPR SCSI driver, introduced by the recent addition 
of MSI
domains on pseries.

A big series including 8 BPF fixes, some with potential security impact and the 
rest
various code generation issues.

Fix our program check assembler entry path, which was accidentally jumping into 
a gas
macro and generating strange stack frames, which could confuse find_bug().

A couple of fixes, and related changes, to fix corner cases in our machine 
check handling.

Fix our DMA IOMMU ops, which were not always returning the optimal DMA mask, 
leading to
at least one device falling back to 32-bit DMA when it shouldn't.

A fix for KUAP handling on 32-bit Book3S.

Fix crashes seen when kdumping on some pseries systems.

Thanks to: Naveen N. Rao, Nicholas Piggin, Alexey Kardashevskiy, Cédric Le 
Goater,
Christophe Leroy, Mahesh Salgaonkar, Abdul Haleem, Christoph Hellwig, Johan 
Almbladh, Stan
Johnson.

- --
Alexey Kardashevskiy (1):
  powerpc/iommu: Report the correct most efficient DMA mask for PCI devices

Christophe Leroy (1):
  powerpc/32s: Fix kuap_kernel_restore()

Cédric Le Goater (1):
  powerpc/pseries/msi: Add an empty irq_write_msi_msg() handler

Mahesh Salgaonkar (1):
  pseries/eeh: Fix the kdump kernel crash during eeh_pseries_init

Naveen N. Rao (10):
  powerpc/lib: Add helper to check if offset is within conditional branch 
range
  powerpc/bpf: Validate branch ranges
  powerpc/bpf: Fix BPF_MOD when imm == 1
  powerpc/bpf: Fix BPF_SUB when imm == 0x8000
  powerpc/security: Add a helper to query stf_barrier type
  powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC
  powerpc/bpf ppc32: Fix ALU32 BPF_ARSH operation
  powerpc/bpf ppc32: Fix JMP32_JSET_K
  powerpc/bpf ppc32: Do not emit zero extend instruction for 64-bit BPF_END
  powerpc/bpf ppc32: Fix BPF_SUB when imm == 0x8000

Nicholas Piggin (5):
  powerpc/64s: fix program check interrupt emergency stack path
  powerpc/traps: do not enable irqs in _exception
  powerpc/64: warn if local irqs are enabled in NMI or hardirq context
  powerpc/64/interrupt: Reconcile soft-mask state in NMI and fix false BUG
  powerpc/64s: Fix unrecoverable MCE calling async handler from NMI


 arch/powerpc/include/asm/book3s/32/kup.h |   8 ++
 arch/powerpc/include/asm/code-patching.h |   1 +
 arch/powerpc/include/asm/interrupt.h |  18 ++--
 arch/powerpc/include/asm/security_features.h |   5 +
 arch/powerpc/kernel/dma-iommu.c  |   9 ++
 arch/powerpc/kernel/exceptions-64s.S |  25 +++--
 arch/powerpc/kernel/irq.c|   6 ++
 arch/powerpc/kernel/security.c   |   5 +
 arch/powerpc/kernel/traps.c  |  43 +
 arch/powerpc/lib/code-patching.c |   7 +-
 arch/powerpc/net/bpf_jit.h   |  33 ---
 arch/powerpc/net/bpf_jit64.h |   8 +-
 arch/powerpc/net/bpf_jit_comp.c  |   6 +-
 arch/powerpc/net/bpf_jit_comp32.c|  16 ++--
 arch/powerpc/net/bpf_jit_comp64.c| 100 
 arch/powerpc/platforms/pseries/eeh_pseries.c |   4 +
 arch/powerpc/platforms/pseries/msi.c |  15 +++
 17 files changed, 234 insertions(+), 75 deletions(-)
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmFi26IACgkQUevqPMjh
pYCMSxAAh40nmRryws4rJ6R6UQlp5eKKAitlFo5y/P3h/qNzu5kelwkS93tog5CA
9i/uznMlyu3jpauHiDaeZCU0WYBqs3AL3qE11pHeG4HkGCCQ/D5eX3KxFRYuqbWh
mfGvgRGxr4Rew3ACgQ/eUGwU9DkzmAr49CX9/5MR8chpNzeERpPMcq4jolEjkfJl
Jf74WoIhHkuDMXFWVC8Aj6AKuQM+Ia9bXhSAFUIk2yjKRdADFgnR8stjzebW8B5v
rSJ9WWNFt97UcgpTcvE+0gEuXFdD3cR16Ov6ObdZjsT1Y3ubC9jTZXy/pO8+YZbq
jjGjNfxp7eWr6umgd2bhO5RKDwu/PbKvhM3l8OPQxOkoGK4L8trPm2IGEFjVyV/1
/vhMa439vbPtT7eItmXEuEqgouUCzwA11Du7KhZu+IkdWyJCXsRzkExTI+rYGAYU
nokOmE6A9VI4sgqLXAOxVSWDQSURhBfXx5cGeu9sdWNZ1V/F1TCi9kslE4eSlJie
NjT5X1rEnM4HDMBKuiSkmu2GzcCAP5IktrkzAmWt1CbFWtLqdOExTmQGR/3DNMwp
SniCYTgAw9GdGz46Zkiprr1X8fEqyrGBY6kjrAJ6Yior2Oy5GxU23w7UmE5iddFx
jXsVMOh6dWIvJlhkeFEjLed3NezkpQuKehM0inOcAiPcCpnZhYc=
=hYTj
-END PGP SIGNATURE-


Re: [PATCH v2 00/11] Add Apple M1 support to PASemi i2c driver

2021-10-10 Thread Sven Peter
On Sat, Oct 9, 2021, at 15:57, Christian Zigotzky wrote:
> On 09 October 2021 at 12:10 pm, Wolfram Sang wrote:
>>> I still don't have access to any old PASemi hardware but the changes from
>>> v1 are pretty small and I expect them to still work. Would still be nice
>>> if someone with access to such hardware could give this a quick test.
>> Looks good to me. I will wait a few more days so that people can report
>> their tests. But it will be in the next merge window.
>>
> Series v2:
>
> Tested-by: Christian Zigotzky  [1]

thanks a lot, glad to hear everything works on P.A Semi CPUs as well!

And regarding that git am issue you wrote about: I think I based this series on
torvald's tree instead of 5.15-rc4 and there have been some changes to at least
MAINTAINERS. It'll probably apply cleanly to 5.15-rc5 but if that happens again
in the future you can try

  git am -3 mbox

instead. It'll try to do a three way merge if the patch doesn't apply cleanly.


Sven



[PATCH] scsi: ibmvscsi: Use dma_alloc_coherent() instead of get_zeroed_page/dma_map_single()

2021-10-10 Thread Cai Huoqing
Replacing get_zeroed_page/free_page/dma_map_single/dma_unmap_single()
with dma_alloc_coherent/dma_free_coherent() helps to reduce
code size, and simplify the code, and coherent DMA will not
clear the cache every time.

Signed-off-by: Cai Huoqing 
---
 drivers/scsi/ibmvscsi/ibmvfc.c   | 15 +++
 drivers/scsi/ibmvscsi/ibmvscsi.c | 26 ++
 2 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 1f1586ad48fe..f65d1a78b272 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -869,8 +869,7 @@ static void ibmvfc_free_queue(struct ibmvfc_host *vhost,
 {
struct device *dev = vhost->dev;
 
-   dma_unmap_single(dev, queue->msg_token, PAGE_SIZE, DMA_BIDIRECTIONAL);
-   free_page((unsigned long)queue->msgs.handle);
+   dma_free_coherent(dev, PAGE_SIZE, queue->msgs.handle, queue->msg_token);
queue->msgs.handle = NULL;
 
ibmvfc_free_event_pool(vhost, queue);
@@ -5663,19 +5662,11 @@ static int ibmvfc_alloc_queue(struct ibmvfc_host *vhost,
return -ENOMEM;
}
 
-   queue->msgs.handle = (void *)get_zeroed_page(GFP_KERNEL);
+   queue->msgs.handle = dma_alloc_coherent(dev, PAGE_SIZE,
+   &queue->msg_token, GFP_KERNEL);
if (!queue->msgs.handle)
return -ENOMEM;
 
-   queue->msg_token = dma_map_single(dev, queue->msgs.handle, PAGE_SIZE,
- DMA_BIDIRECTIONAL);
-
-   if (dma_mapping_error(dev, queue->msg_token)) {
-   free_page((unsigned long)queue->msgs.handle);
-   queue->msgs.handle = NULL;
-   return -ENOMEM;
-   }
-
queue->cur = 0;
queue->fmt = fmt;
queue->size = PAGE_SIZE / fmt_size;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index ea8e01f49cba..61b315d1edbc 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -151,10 +151,7 @@ static void ibmvscsi_release_crq_queue(struct crq_queue 
*queue,
msleep(100);
rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
} while ((rc == H_BUSY) || (H_IS_LONG_BUSY(rc)));
-   dma_unmap_single(hostdata->dev,
-queue->msg_token,
-queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
-   free_page((unsigned long)queue->msgs);
+   dma_free_coherent(hostdata->dev, PAGE_SIZE, queue->msgs, 
queue->msg_token);
 }
 
 /**
@@ -331,18 +328,11 @@ static int ibmvscsi_init_crq_queue(struct crq_queue 
*queue,
int retrc;
struct vio_dev *vdev = to_vio_dev(hostdata->dev);
 
-   queue->msgs = (struct viosrp_crq *)get_zeroed_page(GFP_KERNEL);
-
-   if (!queue->msgs)
-   goto malloc_failed;
queue->size = PAGE_SIZE / sizeof(*queue->msgs);
-
-   queue->msg_token = dma_map_single(hostdata->dev, queue->msgs,
- queue->size * sizeof(*queue->msgs),
- DMA_BIDIRECTIONAL);
-
-   if (dma_mapping_error(hostdata->dev, queue->msg_token))
-   goto map_failed;
+   queue->msgs = dma_alloc_coherent(hostdata->dev, PAGE_SIZE,
+   &queue->msg_token, GFP_KERNEL);
+   if (!queue->msg)
+   goto malloc_failed;
 
gather_partition_info();
set_adapter_info(hostdata);
@@ -395,11 +385,7 @@ static int ibmvscsi_init_crq_queue(struct crq_queue *queue,
rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
} while ((rc == H_BUSY) || (H_IS_LONG_BUSY(rc)));
   reg_crq_failed:
-   dma_unmap_single(hostdata->dev,
-queue->msg_token,
-queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
-  map_failed:
-   free_page((unsigned long)queue->msgs);
+   dma_free_coherent(hostdata->dev, PAGE_SIZE, queue->msg, 
queue->msg_token);
   malloc_failed:
return -1;
 }
-- 
2.25.1



[PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()

2021-10-10 Thread Cai Huoqing
Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
helps to reduce code size, and simplify the code, and coherent
DMA will not clear the cache every time.

Signed-off-by: Cai Huoqing 
---
 drivers/char/tpm/tpm_ibmvtpm.c | 61 ++
 1 file changed, 18 insertions(+), 43 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 3af4c07a9342..5f55a14ee824 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -356,15 +356,12 @@ static void tpm_ibmvtpm_remove(struct vio_dev *vdev)
rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
} while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
 
-   dma_unmap_single(ibmvtpm->dev, ibmvtpm->crq_dma_handle,
-CRQ_RES_BUF_SIZE, DMA_BIDIRECTIONAL);
-   free_page((unsigned long)ibmvtpm->crq_queue.crq_addr);
-
-   if (ibmvtpm->rtce_buf) {
-   dma_unmap_single(ibmvtpm->dev, ibmvtpm->rtce_dma_handle,
-ibmvtpm->rtce_size, DMA_BIDIRECTIONAL);
-   kfree(ibmvtpm->rtce_buf);
-   }
+   dma_free_coherent(ibmvtpm->dev, CRQ_RES_BUF_SIZE,
+ crq_q->crq_addr, crq_q->crq_dma_handle);
+
+   if (ibmvtpm->rtce_buf)
+   dma_free_coherent(ibmvtpm->dev, ibmvtpm->rtce_size,
+ ibmvtpm->rtce_buf, ibmvtpm->rtce_dma_handle);
 
kfree(ibmvtpm);
/* For tpm_ibmvtpm_get_desired_dma */
@@ -522,23 +519,12 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
return;
}
ibmvtpm->rtce_size = be16_to_cpu(crq->len);
-   ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size,
-   GFP_ATOMIC);
-   if (!ibmvtpm->rtce_buf) {
-   dev_err(ibmvtpm->dev, "Failed to allocate 
memory for rtce buffer\n");
-   return;
-   }
-
-   ibmvtpm->rtce_dma_handle = dma_map_single(ibmvtpm->dev,
-   ibmvtpm->rtce_buf, ibmvtpm->rtce_size,
-   DMA_BIDIRECTIONAL);
-
-   if (dma_mapping_error(ibmvtpm->dev,
- ibmvtpm->rtce_dma_handle)) {
-   kfree(ibmvtpm->rtce_buf);
-   ibmvtpm->rtce_buf = NULL;
-   dev_err(ibmvtpm->dev, "Failed to dma map rtce 
buffer\n");
-   }
+   ibmvtpm->rtce_buf = dma_alloc_coherent(ibmvtpm->dev,
+  
ibmvtpm->rtce_size,
+  
&ibmvtpm->rtce_dma_handle,
+  GFP_ATOMIC);
+   if (!ibmvtpm->rtce_buf)
+   dev_err(ibmvtpm->dev, "Failed to dma allocate 
rtce buffer\n");
 
return;
case VTPM_GET_VERSION_RES:
@@ -618,22 +604,13 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
ibmvtpm->vdev = vio_dev;
 
crq_q = &ibmvtpm->crq_queue;
-   crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
-   if (!crq_q->crq_addr) {
-   dev_err(dev, "Unable to allocate memory for crq_addr\n");
-   goto cleanup;
-   }
 
crq_q->num_entry = CRQ_RES_BUF_SIZE / sizeof(*crq_q->crq_addr);
init_waitqueue_head(&crq_q->wq);
-   ibmvtpm->crq_dma_handle = dma_map_single(dev, crq_q->crq_addr,
-CRQ_RES_BUF_SIZE,
-DMA_BIDIRECTIONAL);
-
-   if (dma_mapping_error(dev, ibmvtpm->crq_dma_handle)) {
-   dev_err(dev, "dma mapping failed\n");
+   crq_q->crq_addr = dma_alloc_coherent(dev, CRQ_RES_BUF_SIZE,
+   &ibmvtpm->crq_dma_handle, 
GFP_KERNEL);
+   if (!crq_q->crq_addr)
goto cleanup;
-   }
 
rc = plpar_hcall_norets(H_REG_CRQ, vio_dev->unit_address,
ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE);
@@ -642,7 +619,7 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
 
if (rc) {
dev_err(dev, "Unable to register CRQ rc=%d\n", rc);
-   goto reg_crq_cleanup;
+   goto cleanup;
}
 
rc = request_irq(vio_dev->irq, ibmvtpm_interrupt, 0,
@@ -704,13 +681,11 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
do {
rc1 = plpar_hcall_norets(H_FREE_CRQ, vio_dev->unit_address);
} while (rc1 == H_BUSY || H_IS_LONG_BUSY(rc1));
-reg_crq_cleanup:

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.15-3 tag

2021-10-10 Thread pr-tracker-bot
The pull request you sent on Sun, 10 Oct 2021 23:26:30 +1100:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
> tags/powerpc-5.15-3

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/efb52a7d9511df818391f1afa459507425833438

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


Re: linux-next: build warnings in Linus' tree

2021-10-10 Thread Stephen Rothwell
Hi all,

[Cc'ing Rob]

Rob: these warnings have been there for a long time ...

On Fri, 8 Oct 2021 16:47:28 +1100 Stephen Rothwell  
wrote:
>
> Hi all,
> 
> After merging the origin tree, today's linux-next build (powerpc
> allyesconfig) produced these warnings (along with many others):
> 
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> arch/powerpc/boot/dts/mpc5200b.dtsi:182.18-186.5: Warning (spi_bus_bridge): 
> /soc5200@f000/psc@2000: node name for SPI buses should be 'spi'
> arch/powerpc/boot/dts/mpc5200b.dtsi:267.20-280.4: Warning (pci_bridge): 
> /pci@fd00: missing ranges for PCI bridge (or not a bridge)
> 
> Given that arch/powerpc/boot/dts/mpc5200b.dtsi is oncluded by several
> other dts files, fixing this one file would go quite a long way to
> silencing our allyesoncig build.  Unfotunatley, I have no idea how to
> fix this file (ad maybe some fo the interactions it has with other files).

-- 
Cheers,
Stephen Rothwell


pgpn0gFLQCRw8.pgp
Description: OpenPGP digital signature


[powerpc:merge] BUILD SUCCESS ece9c55cc2f2c408240cd5627ea46926e9d4e5eb

2021-10-10 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
merge
branch HEAD: ece9c55cc2f2c408240cd5627ea46926e9d4e5eb  Automatic merge of 
'master' into merge (2021-10-10 22:52)

elapsed time: 723m

configs tested: 208
configs skipped: 4

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm defconfig
arm64allyesconfig
arm64   defconfig
arm  allyesconfig
arm  allmodconfig
i386 randconfig-c001-20211010
mips randconfig-c004-20211010
powerpcge_imp3a_defconfig
m68k   m5249evb_defconfig
arm   viper_defconfig
openrisc simple_smp_defconfig
arm   omap2plus_defconfig
m68k   m5475evb_defconfig
sh   allmodconfig
powerpc   lite5200b_defconfig
arm  imote2_defconfig
powerpc   motionpro_defconfig
mips tb0219_defconfig
ia64  tiger_defconfig
arm   milbeaut_m10v_defconfig
mips  rb532_defconfig
s390   zfcpdump_defconfig
mips loongson2k_defconfig
mipsmaltaup_defconfig
shapsh4ad0a_defconfig
powerpc  ppc40x_defconfig
armxcep_defconfig
arm  badge4_defconfig
mips  maltasmvp_defconfig
mips cobalt_defconfig
sh   se7780_defconfig
arm cm_x300_defconfig
sh  rts7751r2d1_defconfig
powerpc ep8248e_defconfig
powerpc ksi8560_defconfig
mips   ip28_defconfig
arm bcm2835_defconfig
powerpc rainier_defconfig
arm  exynos_defconfig
arm  simpad_defconfig
arm   imx_v4_v5_defconfig
powerpc redwood_defconfig
sparc64 defconfig
powerpc wii_defconfig
ia64 bigsur_defconfig
mipsbcm63xx_defconfig
armpleb_defconfig
armmvebu_v7_defconfig
m68k  multi_defconfig
mips   sb1250_swarm_defconfig
powerpc64   defconfig
powerpcmvme5100_defconfig
powerpcwarp_defconfig
xtensa  defconfig
openriscor1ksim_defconfig
sh  sh7785lcr_32bit_defconfig
powerpc mpc836x_mds_defconfig
nios2alldefconfig
powerpcadder875_defconfig
sh   se7343_defconfig
h8300   defconfig
sh  lboxre2_defconfig
powerpcsam440ep_defconfig
powerpcamigaone_defconfig
sh apsh4a3a_defconfig
sh   j2_defconfig
powerpc   eiger_defconfig
arm axm55xx_defconfig
arm   sama7_defconfig
arm  iop32x_defconfig
powerpc ps3_defconfig
riscvnommu_k210_defconfig
nds32   defconfig
h8300alldefconfig
powerpc  iss476-smp_defconfig
mips rt305x_defconfig
arm lpc18xx_defconfig
powerpc  g5_defconfig
m68k amcore_defconfig
m68k   bvme6000_defconfig
ia64  gensparse_defconfig
arm pxa_defconfig
sh   se7206_defconfig
sh   se7724_defconfig
armoxnas_v6_defconfig
armrealview_defconfig
powerpc sequoia_defconfig
sparc   sparc32_defconfig
arm orion5x_defconfig
arm  colibri_pxa300_defconfig
powerpc  acadia_defconfig
xtensa  iss_defconfig
arm  pxa910_defconfig
h8300   h8s-sim_defconfig
sh   se7750_defconfig
powerpc mpc832x_rdb_defconfig
mips  decstation_64_defconfig
sh shx3_defconfig
powerpc  mgcoge_defconfig
mips  malta_defco

Re: [PATCH v6 19/22] powerpc/book3s64/hash/kuap: Enable kuap on hash

2021-10-10 Thread Michael Ellerman
Christophe Leroy  writes:
> Le 25/11/2020 à 06:16, Aneesh Kumar K.V a écrit :
>> Reviewed-by: Sandipan Das 
>> Signed-off-by: Aneesh Kumar K.V 
>> ---
>>   arch/powerpc/mm/book3s64/pkeys.c | 7 ++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/mm/book3s64/pkeys.c 
>> b/arch/powerpc/mm/book3s64/pkeys.c
>> index f747d66cc87d..84f8664ffc47 100644
>> --- a/arch/powerpc/mm/book3s64/pkeys.c
>> +++ b/arch/powerpc/mm/book3s64/pkeys.c
>> @@ -257,7 +257,12 @@ void __init setup_kuep(bool disabled)
>>   #ifdef CONFIG_PPC_KUAP
>>   void __init setup_kuap(bool disabled)
>>   {
>> -if (disabled || !early_radix_enabled())
>> +if (disabled)
>> +return;
>> +/*
>> + * On hash if PKEY feature is not enabled, disable KUAP too.
>> + */
>> +if (!early_radix_enabled() && !early_mmu_has_feature(MMU_FTR_PKEY))
>
> pkey_early_init_devtree() bails out without setting MMU_FTR_PKEY with 
> the following:
>
>   /*
>* Only P7 and above supports SPRN_AMR update with MSR[PR] = 1
>*/
>   if (!early_cpu_has_feature(CPU_FTR_ARCH_206))
>   return;
>
>
>
> Why would it be impossible to do KUAP in that case ? KUAP doesn't 
> require updating SPRN_AMR with MSR[PR] = 1

You're right, it would be possible to do KUAP in that case.

That's an artifact of KUAP being implemented using PKEYs on hash. For
the PKEYs user-visible API we want AMR to be user controlled.

It's possible we could untangle all that, allowing KUAP to be
implemented on earlier CPUs, but I'm not sure it's going to be high on
anyone's todo list.

cheers