* [PATCH 1/5] powerpc/perf: Add new power pmu flag "PPMU_P10_DD1" for power10 DD1
From: Madhavan Srinivasan @ 2020-10-21 8:53 UTC (permalink / raw)
To: mpe; +Cc: atrajeev, linuxppc-dev, Madhavan Srinivasan
From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Add a new power PMU flag "PPMU_P10_DD1" which can be
used to conditionally add any code path for power10 DD1 processor
version. Also modify power10 PMU driver code to set this
flag only for DD1, based on the Processor Version Register (PVR)
value.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
arch/powerpc/include/asm/perf_event_server.h | 1 +
arch/powerpc/perf/power10-pmu.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index f6acabb6c9be..3b7baba01c92 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -82,6 +82,7 @@ struct power_pmu {
#define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */
#define PPMU_NO_SIAR 0x00000100 /* Do not use SIAR */
#define PPMU_ARCH_31 0x00000200 /* Has MMCR3, SIER2 and SIER3 */
+#define PPMU_P10_DD1 0x00000400 /* Is power10 DD1 processor version */
/*
* Values for flags to get_alternatives()
diff --git a/arch/powerpc/perf/power10-pmu.c b/arch/powerpc/perf/power10-pmu.c
index 9dbe8f9b89b4..a01e87f0b8d0 100644
--- a/arch/powerpc/perf/power10-pmu.c
+++ b/arch/powerpc/perf/power10-pmu.c
@@ -403,6 +403,7 @@ static struct power_pmu power10_pmu = {
int init_power10_pmu(void)
{
+ unsigned int pvr;
int rc;
/* Comes from cpu_specs[] */
@@ -410,6 +411,11 @@ int init_power10_pmu(void)
strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power10"))
return -ENODEV;
+ pvr = mfspr(SPRN_PVR);
+ /* Add the ppmu flag for power10 DD1 */
+ if ((PVR_CFG(pvr) == 1))
+ power10_pmu.flags |= PPMU_P10_DD1;
+
/* Set the PERF_REG_EXTENDED_MASK here */
PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_31;
--
2.26.2
^ permalink raw reply related
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Laurent Vivier @ 2020-10-21 7:54 UTC (permalink / raw)
To: Finn Thain, Brad Boyer
Cc: Greg KH, linux-kernel, linux-m68k, Geert Uytterhoeven,
linux-serial, Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <alpine.LNX.2.23.453.2010211038390.6@nippy.intranet>
Le 21/10/2020 à 01:43, Finn Thain a écrit :
> On Tue, 20 Oct 2020, Brad Boyer wrote:
>
>>
>> Wouldn't it be better to rearrange this code to only run if the devices
>> are present? This is a macio driver on pmac and a platform driver on
>> mac, so shouldn't it be possible to only run this code when the
>> appropriate entries are present in the right data structures?
>>
>> I didn't look at a lot of the other serial drivers, but some other mac
>> drivers have recently been updated to no longer have MACH_IS_MAC checks
>> due to being converted to platform drivers.
>>
>
> Actually, it's not simply a platform driver or macio driver. I think the
> console is supposed to be registered before the normal bus matching takes
> place. Hence this comment in pmac_zilog.c,
>
> /*
> * First, we need to do a direct OF-based probe pass. We
> * do that because we want serial console up before the
> * macio stuffs calls us back, and since that makes it
> * easier to pass the proper number of channels to
> * uart_register_driver()
> */
>
> Laurent, can we avoid the irq == 0 warning splat like this?
>
> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> index 96e7aa479961..7db600cd8cc7 100644
> --- a/drivers/tty/serial/pmac_zilog.c
> +++ b/drivers/tty/serial/pmac_zilog.c
> @@ -1701,8 +1701,10 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
> int irq;
>
> r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0);
> + if (!r_ports)
> + return -ENODEV;
> irq = platform_get_irq(uap->pdev, 0);
> - if (!r_ports || irq <= 0)
> + if (irq <= 0)
> return -ENODEV;
>
> uap->port.mapbase = r_ports->start;
>
No, this doesn't fix the problem.
The message is still:
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] WARNING: CPU: 0 PID: 0 at drivers/base/platform.c:224
platform_get_irq_optional+0x7a/0x80
[ 0.000000] 0 is an invalid IRQ number
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.9.0+ #324
[ 0.000000] Stack from 004e7f24:
004e7f24 0046c1d3 0046c1d3 0002cb26 004985fb
000000e0 00000009 00000000
0002cb6a 004985fb 000000e0 002a5b86 00000009
00000000 004e7f70 00553cc4
00000000 00000000 00000000 004985df 004e7f90
004e7ff8 002a5b86 004985fb
000000e0 00000009 004985df 004eb290 002a5bd2
004eb290 00000000 00553cc4
0057bb66 00553cc4 00573d6e 004eb290 00000000
00573d38 0021c42c 00573e06
00553cc4 0046df15 00583a7c 00573e58 00564b74
0005299a 0055ce34 00000000
[ 0.000000] Call Trace: [<0002cb26>] __warn+0xb2/0xb4
[ 0.000000] [<0002cb6a>] warn_slowpath_fmt+0x42/0x64
[ 0.000000] [<002a5b86>] platform_get_irq_optional+0x7a/0x80
[ 0.000000] [<002a5b86>] platform_get_irq_optional+0x7a/0x80
[ 0.000000] [<002a5bd2>] platform_get_irq+0x16/0x42
[ 0.000000] [<00573d6e>] pmz_init_port+0x36/0x9e
[ 0.000000] [<00573d38>] pmz_init_port+0x0/0x9e
[ 0.000000] [<0021c42c>] strlen+0x0/0x14
[ 0.000000] [<00573e06>] pmz_probe+0x30/0x7e
[ 0.000000] [<00573e58>] pmz_console_init+0x4/0x22
[ 0.000000] [<00564b74>] console_init+0x1e/0x20
[ 0.000000] [<0005299a>] printk+0x0/0x18
[ 0.000000] [<0055ce34>] start_kernel+0x332/0x4c4
[ 0.000000] [<0055b8c6>] _sinittext+0x8c6/0x1268
[ 0.000000] ---[ end trace 32d780b8cd50b829 ]---
Thanks,
Laurent
^ permalink raw reply
* Re: [PATCH 2/2] dt: Remove booting-without-of.rst
From: Mauro Carvalho Chehab @ 2020-10-21 6:45 UTC (permalink / raw)
To: Rob Herring
Cc: devicetree, Thomas Bogendoerfer, Yoshinori Sato,
Geert Uytterhoeven, Jonathan Corbet, linux-sh, x86, linux-doc,
linux-kernel, linux-mips, linuxppc-dev, Rich Felker,
Paul Mackerras, H. Peter Anvin, Borislav Petkov, Thomas Gleixner,
Frank Rowand, Ingo Molnar
In-Reply-To: <20201008142420.2083861-2-robh@kernel.org>
Hi Rob,
Em Thu, 8 Oct 2020 09:24:20 -0500
Rob Herring <robh@kernel.org> escreveu:
> booting-without-of.rstt is an ancient document that first outlined
> Flattened DeviceTree on PowerPC initially. The DT world has evolved a
> lot in the 15 years since and booting-without-of.rst is pretty stale.
> The name of the document itself is confusing if you don't understand the
> evolution from real 'OpenFirmware'. Most of what booting-without-of.rst
> contains is now in the DT specification (which evolved out of the
> ePAPR). The few things that weren't documented in the DT specification
> are now.
>
> All that remains is the boot entry details, so let's move these to arch
> specific documents. The exception is arm which already has the same
> details documented.
Removing this document caused a warning at Documentation/arm/booting.rst:
$ ./scripts/documentation-file-ref-check
Documentation/arm/booting.rst: Documentation/devicetree/booting-without-of.rst
as it mentions that the DTB format is described on booting-without-of.rst:
4b. Setup the device tree
-------------------------
The boot loader must load a device tree image (dtb) into system ram
at a 64bit aligned address and initialize it with the boot data. The
dtb format is documented in Documentation/devicetree/booting-without-of.rst.
The kernel will look for the dtb magic value of 0xd00dfeed at the dtb
physical address to determine if a dtb has been passed instead of a
tagged list.
So, I guess that such part of the document needs to be moved to booting.rst.
Thanks,
Mauro
^ permalink raw reply
* [powerpc:merge] BUILD SUCCESS 598b738031de83cadbcf745ad0ad2bd69a0ee012
From: kernel test robot @ 2020-10-21 4:05 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge
branch HEAD: 598b738031de83cadbcf745ad0ad2bd69a0ee012 Automatic merge of 'master' into merge (2020-10-20 23:14)
elapsed time: 928m
configs tested: 128
configs skipped: 2
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
arm colibri_pxa300_defconfig
sh kfr2r09_defconfig
mips maltasmvp_eva_defconfig
m68k apollo_defconfig
arm aspeed_g5_defconfig
sh se7722_defconfig
alpha alldefconfig
m68k amcore_defconfig
mips e55_defconfig
sh sh7757lcr_defconfig
ia64 allmodconfig
m68k mvme16x_defconfig
sh ecovec24-romimage_defconfig
mips loongson3_defconfig
mips malta_kvm_guest_defconfig
mips workpad_defconfig
powerpc klondike_defconfig
sh ecovec24_defconfig
xtensa nommu_kc705_defconfig
nios2 defconfig
arm ebsa110_defconfig
powerpc pcm030_defconfig
csky defconfig
powerpc64 alldefconfig
mips lemote2f_defconfig
powerpc mpc836x_rdk_defconfig
s390 debug_defconfig
powerpc ppc64_defconfig
sh shmin_defconfig
arm viper_defconfig
powerpc iss476-smp_defconfig
powerpc bluestone_defconfig
sh ap325rxa_defconfig
arm at91_dt_defconfig
arm milbeaut_m10v_defconfig
mips mpc30x_defconfig
mips ath79_defconfig
arm vt8500_v6_v7_defconfig
powerpc mpc832x_rdb_defconfig
mips rm200_defconfig
parisc generic-64bit_defconfig
arm mps2_defconfig
sh urquell_defconfig
arm stm32_defconfig
powerpc canyonlands_defconfig
openrisc simple_smp_defconfig
h8300 edosk2674_defconfig
x86_64 defconfig
powerpc mpc836x_mds_defconfig
arc axs103_defconfig
sh sh7724_generic_defconfig
openrisc defconfig
mips malta_defconfig
powerpc stx_gp3_defconfig
powerpc mpc866_ads_defconfig
arm pxa3xx_defconfig
nios2 alldefconfig
powerpc mpc8560_ads_defconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
arc allyesconfig
nds32 allnoconfig
c6x allyesconfig
nds32 defconfig
nios2 allyesconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
h8300 allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
s390 allyesconfig
parisc allyesconfig
s390 defconfig
i386 allyesconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
i386 randconfig-a002-20201020
i386 randconfig-a005-20201020
i386 randconfig-a003-20201020
i386 randconfig-a001-20201020
i386 randconfig-a006-20201020
i386 randconfig-a004-20201020
x86_64 randconfig-a011-20201020
x86_64 randconfig-a013-20201020
x86_64 randconfig-a016-20201020
x86_64 randconfig-a015-20201020
x86_64 randconfig-a012-20201020
x86_64 randconfig-a014-20201020
i386 randconfig-a016-20201020
i386 randconfig-a014-20201020
i386 randconfig-a015-20201020
i386 randconfig-a013-20201020
i386 randconfig-a012-20201020
i386 randconfig-a011-20201020
riscv nommu_k210_defconfig
riscv allyesconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
x86_64 rhel
x86_64 allyesconfig
x86_64 rhel-7.6-kselftests
x86_64 rhel-8.3
x86_64 kexec
clang tested configs:
x86_64 randconfig-a001-20201020
x86_64 randconfig-a002-20201020
x86_64 randconfig-a003-20201020
x86_64 randconfig-a006-20201020
x86_64 randconfig-a005-20201020
x86_64 randconfig-a004-20201020
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* [powerpc:fixes-test] BUILD SUCCESS d1781f23704707d350b8c9006e2bdf5394bf91b2
From: kernel test robot @ 2020-10-21 4:05 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test
branch HEAD: d1781f23704707d350b8c9006e2bdf5394bf91b2 selftests/powerpc: Make alignment handler test P9N DD2.1 vector CI load workaround
elapsed time: 930m
configs tested: 212
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
powerpc bluestone_defconfig
sh rsk7203_defconfig
arc nsimosci_hs_smp_defconfig
sparc alldefconfig
m68k sun3x_defconfig
arm palmz72_defconfig
ia64 defconfig
sh edosk7760_defconfig
arm realview_defconfig
i386 defconfig
mips rbtx49xx_defconfig
arm colibri_pxa300_defconfig
sh se7722_defconfig
sh kfr2r09_defconfig
mips maltasmvp_eva_defconfig
m68k apollo_defconfig
arm aspeed_g5_defconfig
alpha alldefconfig
m68k amcore_defconfig
mips e55_defconfig
sh sh7757lcr_defconfig
arm ebsa110_defconfig
powerpc obs600_defconfig
sh sh03_defconfig
riscv allyesconfig
powerpc maple_defconfig
um x86_64_defconfig
sh titan_defconfig
mips rb532_defconfig
sh lboxre2_defconfig
arm hackkit_defconfig
um i386_defconfig
openrisc simple_smp_defconfig
h8300 allyesconfig
powerpc sam440ep_defconfig
powerpc klondike_defconfig
sh ecovec24-romimage_defconfig
arm spear13xx_defconfig
ia64 allmodconfig
m68k mvme16x_defconfig
mips loongson3_defconfig
mips tb0219_defconfig
powerpc g5_defconfig
m68k mvme147_defconfig
arm colibri_pxa270_defconfig
mips decstation_64_defconfig
mips malta_kvm_guest_defconfig
mips workpad_defconfig
sh ecovec24_defconfig
xtensa nommu_kc705_defconfig
arc vdk_hs38_defconfig
powerpc mpc834x_itxgp_defconfig
mips maltaup_xpa_defconfig
mips pistachio_defconfig
mips decstation_r4k_defconfig
sh magicpanelr2_defconfig
mips loongson1c_defconfig
mips capcella_defconfig
arc alldefconfig
powerpc ppc40x_defconfig
mips ci20_defconfig
nios2 defconfig
powerpc pcm030_defconfig
csky defconfig
powerpc64 alldefconfig
mips lemote2f_defconfig
powerpc mpc836x_rdk_defconfig
s390 debug_defconfig
powerpc ppc64_defconfig
sh shmin_defconfig
arm viper_defconfig
powerpc iss476-smp_defconfig
powerpc motionpro_defconfig
sh sdk7786_defconfig
arm ep93xx_defconfig
sh ul2_defconfig
sh ap325rxa_defconfig
arm at91_dt_defconfig
arm milbeaut_m10v_defconfig
mips mpc30x_defconfig
mips ath79_defconfig
s390 zfcpdump_defconfig
arm clps711x_defconfig
sh sh7724_generic_defconfig
m68k m5307c3_defconfig
arc tb10x_defconfig
mips tb0287_defconfig
sh r7785rp_defconfig
powerpc stx_gp3_defconfig
mips maltasmvp_defconfig
arm vt8500_v6_v7_defconfig
sh landisk_defconfig
arm dove_defconfig
arm pxa_defconfig
powerpc tqm8540_defconfig
powerpc pmac32_defconfig
powerpc mpc834x_itx_defconfig
sparc64 defconfig
powerpc taishan_defconfig
sh sh7785lcr_32bit_defconfig
um kunit_defconfig
x86_64 allyesconfig
powerpc mpc832x_rdb_defconfig
mips rm200_defconfig
parisc generic-64bit_defconfig
arm mps2_defconfig
sh urquell_defconfig
arm stm32_defconfig
powerpc canyonlands_defconfig
arm omap2plus_defconfig
powerpc acadia_defconfig
h8300 edosk2674_defconfig
x86_64 defconfig
powerpc mpc836x_mds_defconfig
arc axs103_defconfig
xtensa virt_defconfig
arm eseries_pxa_defconfig
arm assabet_defconfig
sh migor_defconfig
ia64 alldefconfig
openrisc defconfig
mips malta_defconfig
xtensa xip_kc705_defconfig
m68k amiga_defconfig
arc nsimosci_hs_defconfig
arm aspeed_g4_defconfig
arm moxart_defconfig
powerpc rainier_defconfig
arm badge4_defconfig
m68k multi_defconfig
arm corgi_defconfig
parisc defconfig
ia64 generic_defconfig
powerpc mpc7448_hpc2_defconfig
mips maltaaprp_defconfig
mips rt305x_defconfig
m68k m5249evb_defconfig
xtensa iss_defconfig
mips nlm_xlr_defconfig
sh polaris_defconfig
powerpc mpc8313_rdb_defconfig
arm imx_v6_v7_defconfig
riscv defconfig
powerpc mpc866_ads_defconfig
arm pxa3xx_defconfig
nios2 alldefconfig
powerpc mpc8560_ads_defconfig
arm zeus_defconfig
xtensa cadence_csp_defconfig
arc allyesconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nds32 allnoconfig
c6x allyesconfig
nds32 defconfig
nios2 allyesconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
arc defconfig
sh allmodconfig
s390 allyesconfig
parisc allyesconfig
s390 defconfig
i386 allyesconfig
sparc allyesconfig
sparc defconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
i386 randconfig-a002-20201020
i386 randconfig-a005-20201020
i386 randconfig-a003-20201020
i386 randconfig-a001-20201020
i386 randconfig-a006-20201020
i386 randconfig-a004-20201020
x86_64 randconfig-a011-20201020
x86_64 randconfig-a013-20201020
x86_64 randconfig-a016-20201020
x86_64 randconfig-a015-20201020
x86_64 randconfig-a012-20201020
x86_64 randconfig-a014-20201020
i386 randconfig-a016-20201020
i386 randconfig-a014-20201020
i386 randconfig-a015-20201020
i386 randconfig-a013-20201020
i386 randconfig-a012-20201020
i386 randconfig-a011-20201020
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv rv32_defconfig
riscv allmodconfig
x86_64 rhel
x86_64 rhel-7.6-kselftests
x86_64 rhel-8.3
x86_64 kexec
clang tested configs:
x86_64 randconfig-a001-20201020
x86_64 randconfig-a002-20201020
x86_64 randconfig-a003-20201020
x86_64 randconfig-a006-20201020
x86_64 randconfig-a005-20201020
x86_64 randconfig-a004-20201020
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* [PATCH kernel 1/2] Revert "dma-mapping: move large parts of <linux/dma-direct.h> to kernel/dma"
From: Alexey Kardashevskiy @ 2020-10-21 3:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Christoph Hellwig, linux-kernel
In-Reply-To: <20201021032026.45030-1-aik@ozlabs.ru>
This reverts commit 19c65c3d30bb5a97170e425979d2e44ab2096c7d which
was a right move but sadly there is a POWERPC/pseries hardware config
which uses a mixture of direct and IOMMU DMA but bringing this
logic to the generic code won't benefit anybody else. The user of
this revert comes in the next patch.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
include/linux/dma-direct.h | 106 +++++++++++++++++++++++++++++++++
kernel/dma/direct.h | 119 -------------------------------------
kernel/dma/direct.c | 2 +-
kernel/dma/mapping.c | 2 +-
4 files changed, 108 insertions(+), 121 deletions(-)
delete mode 100644 kernel/dma/direct.h
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 18aade195884..e388b77e0048 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -120,8 +120,114 @@ struct page *dma_direct_alloc_pages(struct device *dev, size_t size,
void dma_direct_free_pages(struct device *dev, size_t size,
struct page *page, dma_addr_t dma_addr,
enum dma_data_direction dir);
+int dma_direct_get_sgtable(struct device *dev, struct sg_table *sgt,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size,
+ unsigned long attrs);
+bool dma_direct_can_mmap(struct device *dev);
+int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma,
+ void *cpu_addr, dma_addr_t dma_addr, size_t size,
+ unsigned long attrs);
int dma_direct_supported(struct device *dev, u64 mask);
+bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+ enum dma_data_direction dir, unsigned long attrs);
dma_addr_t dma_direct_map_resource(struct device *dev, phys_addr_t paddr,
size_t size, enum dma_data_direction dir, unsigned long attrs);
+size_t dma_direct_max_mapping_size(struct device *dev);
+#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
+ defined(CONFIG_SWIOTLB)
+void dma_direct_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
+ int nents, enum dma_data_direction dir);
+#else
+static inline void dma_direct_sync_sg_for_device(struct device *dev,
+ struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+}
+#endif
+
+#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
+ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) || \
+ defined(CONFIG_SWIOTLB)
+void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sgl,
+ int nents, enum dma_data_direction dir, unsigned long attrs);
+void dma_direct_sync_sg_for_cpu(struct device *dev,
+ struct scatterlist *sgl, int nents, enum dma_data_direction dir);
+#else
+static inline void dma_direct_unmap_sg(struct device *dev,
+ struct scatterlist *sgl, int nents, enum dma_data_direction dir,
+ unsigned long attrs)
+{
+}
+static inline void dma_direct_sync_sg_for_cpu(struct device *dev,
+ struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+}
+#endif
+
+static inline void dma_direct_sync_single_for_device(struct device *dev,
+ dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+ phys_addr_t paddr = dma_to_phys(dev, addr);
+
+ if (unlikely(is_swiotlb_buffer(paddr)))
+ swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_DEVICE);
+
+ if (!dev_is_dma_coherent(dev))
+ arch_sync_dma_for_device(paddr, size, dir);
+}
+
+static inline void dma_direct_sync_single_for_cpu(struct device *dev,
+ dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+ phys_addr_t paddr = dma_to_phys(dev, addr);
+
+ if (!dev_is_dma_coherent(dev)) {
+ arch_sync_dma_for_cpu(paddr, size, dir);
+ arch_sync_dma_for_cpu_all();
+ }
+
+ if (unlikely(is_swiotlb_buffer(paddr)))
+ swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_CPU);
+
+ if (dir == DMA_FROM_DEVICE)
+ arch_dma_mark_clean(paddr, size);
+}
+
+static inline dma_addr_t dma_direct_map_page(struct device *dev,
+ struct page *page, unsigned long offset, size_t size,
+ enum dma_data_direction dir, unsigned long attrs)
+{
+ phys_addr_t phys = page_to_phys(page) + offset;
+ dma_addr_t dma_addr = phys_to_dma(dev, phys);
+
+ if (unlikely(swiotlb_force == SWIOTLB_FORCE))
+ return swiotlb_map(dev, phys, size, dir, attrs);
+
+ if (unlikely(!dma_capable(dev, dma_addr, size, true))) {
+ if (swiotlb_force != SWIOTLB_NO_FORCE)
+ return swiotlb_map(dev, phys, size, dir, attrs);
+
+ dev_WARN_ONCE(dev, 1,
+ "DMA addr %pad+%zu overflow (mask %llx, bus limit %llx).\n",
+ &dma_addr, size, *dev->dma_mask, dev->bus_dma_limit);
+ return DMA_MAPPING_ERROR;
+ }
+
+ if (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ arch_sync_dma_for_device(phys, size, dir);
+ return dma_addr;
+}
+
+static inline void dma_direct_unmap_page(struct device *dev, dma_addr_t addr,
+ size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+ phys_addr_t phys = dma_to_phys(dev, addr);
+
+ if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+ dma_direct_sync_single_for_cpu(dev, addr, size, dir);
+
+ if (unlikely(is_swiotlb_buffer(phys)))
+ swiotlb_tbl_unmap_single(dev, phys, size, size, dir, attrs);
+}
#endif /* _LINUX_DMA_DIRECT_H */
diff --git a/kernel/dma/direct.h b/kernel/dma/direct.h
deleted file mode 100644
index b98615578737..000000000000
--- a/kernel/dma/direct.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright (C) 2018 Christoph Hellwig.
- *
- * DMA operations that map physical memory directly without using an IOMMU.
- */
-#ifndef _KERNEL_DMA_DIRECT_H
-#define _KERNEL_DMA_DIRECT_H
-
-#include <linux/dma-direct.h>
-
-int dma_direct_get_sgtable(struct device *dev, struct sg_table *sgt,
- void *cpu_addr, dma_addr_t dma_addr, size_t size,
- unsigned long attrs);
-bool dma_direct_can_mmap(struct device *dev);
-int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma,
- void *cpu_addr, dma_addr_t dma_addr, size_t size,
- unsigned long attrs);
-bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr);
-int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
- enum dma_data_direction dir, unsigned long attrs);
-size_t dma_direct_max_mapping_size(struct device *dev);
-
-#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
- defined(CONFIG_SWIOTLB)
-void dma_direct_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
- int nents, enum dma_data_direction dir);
-#else
-static inline void dma_direct_sync_sg_for_device(struct device *dev,
- struct scatterlist *sgl, int nents, enum dma_data_direction dir)
-{
-}
-#endif
-
-#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
- defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) || \
- defined(CONFIG_SWIOTLB)
-void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sgl,
- int nents, enum dma_data_direction dir, unsigned long attrs);
-void dma_direct_sync_sg_for_cpu(struct device *dev,
- struct scatterlist *sgl, int nents, enum dma_data_direction dir);
-#else
-static inline void dma_direct_unmap_sg(struct device *dev,
- struct scatterlist *sgl, int nents, enum dma_data_direction dir,
- unsigned long attrs)
-{
-}
-static inline void dma_direct_sync_sg_for_cpu(struct device *dev,
- struct scatterlist *sgl, int nents, enum dma_data_direction dir)
-{
-}
-#endif
-
-static inline void dma_direct_sync_single_for_device(struct device *dev,
- dma_addr_t addr, size_t size, enum dma_data_direction dir)
-{
- phys_addr_t paddr = dma_to_phys(dev, addr);
-
- if (unlikely(is_swiotlb_buffer(paddr)))
- swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_DEVICE);
-
- if (!dev_is_dma_coherent(dev))
- arch_sync_dma_for_device(paddr, size, dir);
-}
-
-static inline void dma_direct_sync_single_for_cpu(struct device *dev,
- dma_addr_t addr, size_t size, enum dma_data_direction dir)
-{
- phys_addr_t paddr = dma_to_phys(dev, addr);
-
- if (!dev_is_dma_coherent(dev)) {
- arch_sync_dma_for_cpu(paddr, size, dir);
- arch_sync_dma_for_cpu_all();
- }
-
- if (unlikely(is_swiotlb_buffer(paddr)))
- swiotlb_tbl_sync_single(dev, paddr, size, dir, SYNC_FOR_CPU);
-
- if (dir == DMA_FROM_DEVICE)
- arch_dma_mark_clean(paddr, size);
-}
-
-static inline dma_addr_t dma_direct_map_page(struct device *dev,
- struct page *page, unsigned long offset, size_t size,
- enum dma_data_direction dir, unsigned long attrs)
-{
- phys_addr_t phys = page_to_phys(page) + offset;
- dma_addr_t dma_addr = phys_to_dma(dev, phys);
-
- if (unlikely(swiotlb_force == SWIOTLB_FORCE))
- return swiotlb_map(dev, phys, size, dir, attrs);
-
- if (unlikely(!dma_capable(dev, dma_addr, size, true))) {
- if (swiotlb_force != SWIOTLB_NO_FORCE)
- return swiotlb_map(dev, phys, size, dir, attrs);
-
- dev_WARN_ONCE(dev, 1,
- "DMA addr %pad+%zu overflow (mask %llx, bus limit %llx).\n",
- &dma_addr, size, *dev->dma_mask, dev->bus_dma_limit);
- return DMA_MAPPING_ERROR;
- }
-
- if (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
- arch_sync_dma_for_device(phys, size, dir);
- return dma_addr;
-}
-
-static inline void dma_direct_unmap_page(struct device *dev, dma_addr_t addr,
- size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
- phys_addr_t phys = dma_to_phys(dev, addr);
-
- if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
- dma_direct_sync_single_for_cpu(dev, addr, size, dir);
-
- if (unlikely(is_swiotlb_buffer(phys)))
- swiotlb_tbl_unmap_single(dev, phys, size, size, dir, attrs);
-}
-#endif /* _KERNEL_DMA_DIRECT_H */
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 06c111544f61..cf281589cdc6 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -7,13 +7,13 @@
#include <linux/memblock.h> /* for max_pfn */
#include <linux/export.h>
#include <linux/mm.h>
+#include <linux/dma-direct.h>
#include <linux/dma-map-ops.h>
#include <linux/scatterlist.h>
#include <linux/pfn.h>
#include <linux/vmalloc.h>
#include <linux/set_memory.h>
#include <linux/slab.h>
-#include "direct.h"
/*
* Most architectures use ZONE_DMA for the first 16 Megabytes, but some use
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 51bb8fa8eb89..335ba183e095 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -7,6 +7,7 @@
*/
#include <linux/memblock.h> /* for max_pfn */
#include <linux/acpi.h>
+#include <linux/dma-direct.h>
#include <linux/dma-map-ops.h>
#include <linux/export.h>
#include <linux/gfp.h>
@@ -14,7 +15,6 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "debug.h"
-#include "direct.h"
/*
* Managed DMA API
--
2.17.1
^ permalink raw reply related
* [PATCH kernel 2/2] powerpc/dma: Fallback to dma_ops when persistent memory present
From: Alexey Kardashevskiy @ 2020-10-21 3:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Christoph Hellwig, linux-kernel
In-Reply-To: <20201021032026.45030-1-aik@ozlabs.ru>
So far we have been using huge DMA windows to map all the RAM available.
The RAM is normally mapped to the VM address space contiguously, and
there is always a reasonable upper limit for possible future hot plugged
RAM which makes it easy to map all RAM via IOMMU.
Now there is persistent memory ("ibm,pmemory" in the FDT) which (unlike
normal RAM) can map anywhere in the VM space beyond the maximum RAM size
and since it can be used for DMA, it requires extending the huge window
up to MAX_PHYSMEM_BITS which requires hypervisor support for:
1. huge TCE tables;
2. multilevel TCE tables;
3. huge IOMMU pages.
Certain hypervisors cannot do either so the only option left is
restricting the huge DMA window to include only RAM and fallback to
the default DMA window for persistent memory.
This checks if the system has persistent memory. If it does not,
the DMA bypass mode is selected, i.e.
* dev->bus_dma_limit = 0
* dev->dma_ops_bypass = true <- this avoid calling dma_ops for mapping.
If there is such memory, this creates identity mapping only for RAM and
disables the DMA bypass mode which makes generic DMA code use indirect
dma_ops which may have performance impact:
* dev->bus_dma_limit = bus_offset + max_ram_size
for example 0x0800.0000.8000.0000 for a 2GB VM
* dev->dma_ops_bypass = false <- this forces indirect calls to dma_ops for
every mapping which then directs these to small or huge window.
This should not change the existing behaviour when no persistent memory.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Without reverting 19c65c3d30bb5a97170, I could have added
I can repost if this is preferrable. Thanks.
---
Changelog:
v2:
* rebased on current upstream with the device::bypass added and DMA
direct code movement reverted
---
arch/powerpc/kernel/dma-iommu.c | 68 +++++++++++++++++++++++++-
arch/powerpc/platforms/pseries/iommu.c | 41 +++++++++++++---
2 files changed, 99 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index a1c744194018..9a2a3b95f72d 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -10,6 +10,16 @@
#include <linux/pci.h>
#include <asm/iommu.h>
+static inline bool can_map_direct(struct device *dev, phys_addr_t addr)
+{
+ return dev->bus_dma_limit >= phys_to_dma(dev, addr);
+}
+
+static inline bool dma_handle_direct(struct device *dev, dma_addr_t dma_handle)
+{
+ return dma_handle >= dev->archdata.dma_offset;
+}
+
/*
* Generic iommu implementation
*/
@@ -44,6 +54,12 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,
enum dma_data_direction direction,
unsigned long attrs)
{
+ if (dev->bus_dma_limit &&
+ can_map_direct(dev, (phys_addr_t) page_to_phys(page) +
+ offset + size))
+ return dma_direct_map_page(dev, page, offset, size, direction,
+ attrs);
+
return iommu_map_page(dev, get_iommu_table_base(dev), page, offset,
size, dma_get_mask(dev), direction, attrs);
}
@@ -53,6 +69,12 @@ static void dma_iommu_unmap_page(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction direction,
unsigned long attrs)
{
+ if (dev->bus_dma_limit &&
+ dma_handle_direct(dev, dma_handle + size)) {
+ dma_direct_unmap_page(dev, dma_handle, size, direction, attrs);
+ return;
+ }
+
iommu_unmap_page(get_iommu_table_base(dev), dma_handle, size, direction,
attrs);
}
@@ -62,6 +84,22 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
unsigned long attrs)
{
+ if (dev->bus_dma_limit) {
+ struct scatterlist *s;
+ bool direct = true;
+ int i;
+
+ for_each_sg(sglist, s, nelems, i) {
+ direct = can_map_direct(dev,
+ sg_phys(s) + s->offset + s->length);
+ if (!direct)
+ break;
+ }
+ if (direct)
+ return dma_direct_map_sg(dev, sglist, nelems, direction,
+ attrs);
+ }
+
return ppc_iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
dma_get_mask(dev), direction, attrs);
}
@@ -70,6 +108,24 @@ static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
unsigned long attrs)
{
+ if (dev->bus_dma_limit) {
+ struct scatterlist *s;
+ bool direct = true;
+ int i;
+
+ for_each_sg(sglist, s, nelems, i) {
+ direct = dma_handle_direct(dev,
+ s->dma_address + s->length);
+ if (!direct)
+ break;
+ }
+ if (direct) {
+ dma_direct_unmap_sg(dev, sglist, nelems, direction,
+ attrs);
+ return;
+ }
+ }
+
ppc_iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems,
direction, attrs);
}
@@ -90,8 +146,16 @@ int dma_iommu_dma_supported(struct device *dev, u64 mask)
struct iommu_table *tbl = get_iommu_table_base(dev);
if (dev_is_pci(dev) && dma_iommu_bypass_supported(dev, mask)) {
- dev->dma_ops_bypass = true;
- dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n");
+ /*
+ * dma_iommu_bypass_supported() sets dma_max when there is
+ * 1:1 mapping but it is somehow limited.
+ * ibm,pmemory is one example.
+ */
+ dev->dma_ops_bypass = dev->bus_dma_limit == 0;
+ if (!dev->dma_ops_bypass)
+ dev_warn(dev, "iommu: 64-bit OK but using default ops\n");
+ else
+ dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n");
return 1;
}
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index e4198700ed1a..e6aa6c923666 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -839,7 +839,7 @@ static void remove_ddw(struct device_node *np, bool remove_prop)
np, ret);
}
-static u64 find_existing_ddw(struct device_node *pdn)
+static u64 find_existing_ddw(struct device_node *pdn, int *window_shift)
{
struct direct_window *window;
const struct dynamic_dma_window_prop *direct64;
@@ -851,6 +851,7 @@ static u64 find_existing_ddw(struct device_node *pdn)
if (window->device == pdn) {
direct64 = window->prop;
dma_addr = be64_to_cpu(direct64->dma_base);
+ *window_shift = be32_to_cpu(direct64->window_shift);
break;
}
}
@@ -1111,11 +1112,13 @@ static void reset_dma_window(struct pci_dev *dev, struct device_node *par_dn)
*/
static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
{
- int len, ret;
+ int len = 0, ret;
+ bool pmem_present = of_find_node_by_type(NULL, "ibm,pmemory") != NULL;
+ int max_ram_len = order_base_2(ddw_memory_hotplug_max());
struct ddw_query_response query;
struct ddw_create_response create;
int page_shift;
- u64 dma_addr, max_addr;
+ u64 dma_addr;
struct device_node *dn;
u32 ddw_avail[DDW_APPLICABLE_SIZE];
struct direct_window *window;
@@ -1126,7 +1129,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
mutex_lock(&direct_window_init_mutex);
- dma_addr = find_existing_ddw(pdn);
+ dma_addr = find_existing_ddw(pdn, &len);
if (dma_addr != 0)
goto out_unlock;
@@ -1212,14 +1215,27 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
}
/* verify the window * number of ptes will map the partition */
/* check largest block * page size > max memory hotplug addr */
- max_addr = ddw_memory_hotplug_max();
- if (query.largest_available_block < (max_addr >> page_shift)) {
+ /*
+ * The "ibm,pmemory" can appear anywhere in the address space.
+ * Assuming it is still backed by page structs, try MAX_PHYSMEM_BITS
+ * for the upper limit and fallback to max RAM otherwise but this
+ * disables device::dma_ops_bypass.
+ */
+ len = max_ram_len;
+ if (pmem_present) {
+ if (query.largest_available_block >=
+ (1ULL << (MAX_PHYSMEM_BITS - page_shift)))
+ len = MAX_PHYSMEM_BITS - page_shift;
+ else
+ dev_info(&dev->dev, "Skipping ibm,pmemory");
+ }
+
+ if (query.largest_available_block < (1ULL << (len - page_shift))) {
dev_dbg(&dev->dev, "can't map partition max 0x%llx with %llu "
- "%llu-sized pages\n", max_addr, query.largest_available_block,
+ "%llu-sized pages\n", 1ULL << len, query.largest_available_block,
1ULL << page_shift);
goto out_failed;
}
- len = order_base_2(max_addr);
win64 = kzalloc(sizeof(struct property), GFP_KERNEL);
if (!win64) {
dev_info(&dev->dev,
@@ -1299,6 +1315,15 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
out_unlock:
mutex_unlock(&direct_window_init_mutex);
+
+ /*
+ * If we have persistent memory and the window size is only as big
+ * as RAM, then we failed to create a window to cover persistent
+ * memory and need to set the DMA limit.
+ */
+ if (pmem_present && dma_addr && (len == max_ram_len))
+ dev->dev.bus_dma_limit = dma_addr + (1ULL << len);
+
return dma_addr;
}
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v3 01/16] dt-bindings: usb: usb-hcd: Convert generic USB properties to DT schema
From: Chunfeng Yun @ 2020-10-21 3:00 UTC (permalink / raw)
To: Serge Semin
Cc: Neil Armstrong, Bjorn Andersson, Pavel Parkhomenko, Rob Herring,
Kevin Hilman, Krzysztof Kozlowski, Andy Gross, linux-snps-arc,
devicetree, Mathias Nyman, Martin Blumenstingl, Lad Prabhakar,
Alexey Malahov, Rob Herring, linux-arm-kernel, Roger Quadros,
Felipe Balbi, Greg Kroah-Hartman, Yoshihiro Shimoda, linux-usb,
linux-mips, Serge Semin, linux-kernel, Manu Gautam, linuxppc-dev
In-Reply-To: <20201020112101.19077-2-Sergey.Semin@baikalelectronics.ru>
On Tue, 2020-10-20 at 14:20 +0300, Serge Semin wrote:
> The generic USB HCD properties have been described in the legacy bindings
> text file: Documentation/devicetree/bindings/usb/generic.txt . Let's
> convert it' content into the USB HCD DT schema properties so all USB DT
^ its?
> nodes would be validated to have them properly utilized.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Reviewed-by: Rob Herring <robh@kernel.org>
>
> ---
>
> Changelog v2:
> - Discard '|' in all the new properties, since we don't need to preserve
> the text formatting.
> - Convert abbreviated form of the "maximum-speed" enum restriction into
> the multi-lined version of the list.
> - Drop quotes from around the string constants.
> ---
> .../devicetree/bindings/usb/generic.txt | 57 ------------
> .../devicetree/bindings/usb/usb-hcd.yaml | 88 +++++++++++++++++++
Do we need change the file name or modify it's title?
the title is "Generic USB Host Controller Device Tree Bindings", but
some generic properties, such as, dr_mode, usb-role-switch, otg related
ones, are usually used by DRD controller, this may cause some confusion.
> 2 files changed, 88 insertions(+), 57 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/usb/generic.txt
>
> diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt
> deleted file mode 100644
> index ba472e7aefc9..000000000000
> --- a/Documentation/devicetree/bindings/usb/generic.txt
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -Generic USB Properties
> -
> -Optional properties:
> - - maximum-speed: tells USB controllers we want to work up to a certain
> - speed. Valid arguments are "super-speed-plus",
> - "super-speed", "high-speed", "full-speed" and
> - "low-speed". In case this isn't passed via DT, USB
> - controllers should default to their maximum HW
> - capability.
> - - dr_mode: tells Dual-Role USB controllers that we want to work on a
> - particular mode. Valid arguments are "host",
> - "peripheral" and "otg". In case this attribute isn't
> - passed via DT, USB DRD controllers should default to
> - OTG.
> - - phy_type: tells USB controllers that we want to configure the core to support
> - a UTMI+ PHY with an 8- or 16-bit interface if UTMI+ is
> - selected. Valid arguments are "utmi" and "utmi_wide".
> - In case this isn't passed via DT, USB controllers should
> - default to HW capability.
> - - otg-rev: tells usb driver the release number of the OTG and EH supplement
> - with which the device and its descriptors are compliant,
> - in binary-coded decimal (i.e. 2.0 is 0200H). This
> - property is used if any real OTG features(HNP/SRP/ADP)
> - is enabled, if ADP is required, otg-rev should be
> - 0x0200 or above.
> - - companion: phandle of a companion
> - - hnp-disable: tells OTG controllers we want to disable OTG HNP, normally HNP
> - is the basic function of real OTG except you want it
> - to be a srp-capable only B device.
> - - srp-disable: tells OTG controllers we want to disable OTG SRP, SRP is
> - optional for OTG device.
> - - adp-disable: tells OTG controllers we want to disable OTG ADP, ADP is
> - optional for OTG device.
> - - usb-role-switch: boolean, indicates that the device is capable of assigning
> - the USB data role (USB host or USB device) for a given
> - USB connector, such as Type-C, Type-B(micro).
> - see connector/usb-connector.yaml.
> - - role-switch-default-mode: indicating if usb-role-switch is enabled, the
> - device default operation mode of controller while usb
> - role is USB_ROLE_NONE. Valid arguments are "host" and
> - "peripheral". Defaults to "peripheral" if not
> - specified.
> -
> -
> -This is an attribute to a USB controller such as:
> -
> -dwc3@4a030000 {
> - compatible = "synopsys,dwc3";
> - reg = <0x4a030000 0xcfff>;
> - interrupts = <0 92 4>
> - usb-phy = <&usb2_phy>, <&usb3,phy>;
> - maximum-speed = "super-speed";
> - dr_mode = "otg";
> - phy_type = "utmi_wide";
> - otg-rev = <0x0200>;
> - adp-disable;
> -};
> diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> index 7263b7f2b510..ee7ea205c71d 100644
> --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> @@ -22,9 +22,97 @@ properties:
> description:
> Name specifier for the USB PHY
>
> + maximum-speed:
> + description:
> + Tells USB controllers we want to work up to a certain speed. In case this
> + isn't passed via DT, USB controllers should default to their maximum HW
> + capability.
> + $ref: /schemas/types.yaml#/definitions/string
> + enum:
> + - low-speed
> + - full-speed
> + - high-speed
> + - super-speed
> + - super-speed-plus
> +
> + dr_mode:
> + description:
> + Tells Dual-Role USB controllers that we want to work on a particular
> + mode. In case this attribute isn't passed via DT, USB DRD controllers
> + should default to OTG.
> + $ref: /schemas/types.yaml#/definitions/string
> + enum: [host, peripheral, otg]
> +
> + phy_type:
> + description:
> + Tells USB controllers that we want to configure the core to support a
> + UTMI+ PHY with an 8- or 16-bit interface if UTMI+ is selected. In case
> + this isn't passed via DT, USB controllers should default to HW
> + capability.
> + $ref: /schemas/types.yaml#/definitions/string
> + enum: [utmi, utmi_wide]
> +
> + otg-rev:
> + description:
> + Tells usb driver the release number of the OTG and EH supplement with
> + which the device and its descriptors are compliant, in binary-coded
> + decimal (i.e. 2.0 is 0200H). This property is used if any real OTG
> + features (HNP/SRP/ADP) is enabled. If ADP is required, otg-rev should be
> + 0x0200 or above.
> + $ref: /schemas/types.yaml#/definitions/uint32
> +
> + companion:
> + description: Phandle of a companion device
> + $ref: /schemas/types.yaml#/definitions/phandle
> +
> + hnp-disable:
> + description:
> + Tells OTG controllers we want to disable OTG HNP. Normally HNP is the
> + basic function of real OTG except you want it to be a srp-capable only B
> + device.
> + type: boolean
> +
> + srp-disable:
> + description:
> + Tells OTG controllers we want to disable OTG SRP. SRP is optional for OTG
> + device.
> + type: boolean
> +
> + adp-disable:
> + description:
> + Tells OTG controllers we want to disable OTG ADP. ADP is optional for OTG
> + device.
> + type: boolean
> +
> + usb-role-switch:
> + description:
> + Indicates that the device is capable of assigning the USB data role
> + (USB host or USB device) for a given USB connector, such as Type-C,
> + Type-B(micro). See connector/usb-connector.yaml.
> +
> + role-switch-default-mode:
> + description:
> + Indicates if usb-role-switch is enabled, the device default operation
> + mode of controller while usb role is USB_ROLE_NONE.
> + $ref: /schemas/types.yaml#/definitions/string
> + enum: [host, peripheral]
> + default: peripheral
> +
> examples:
> - |
> usb {
> phys = <&usb2_phy1>, <&usb3_phy1>;
> phy-names = "usb";
> };
> + - |
> + usb@4a030000 {
> + compatible = "snps,dwc3";
> + reg = <0x4a030000 0xcfff>;
> + interrupts = <0 92 4>;
> + usb-phy = <&usb2_phy>, <&usb3_phy>;
> + maximum-speed = "super-speed";
> + dr_mode = "otg";
> + phy_type = "utmi_wide";
> + otg-rev = <0x0200>;
> + adp-disable;
> + };
^ permalink raw reply
* [PATCH kernel 0/2] powerpc/dma: Fallback to dma_ops when persistent memory present
From: Alexey Kardashevskiy @ 2020-10-21 3:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alexey Kardashevskiy, Christoph Hellwig, linux-kernel
This allows mixing direct DMA (to/from RAM) and
IOMMU (to/from apersistent memory) on the PPC64/pseries
platform. This was supposed to be a single patch but
unexpected move of direct DMA functions happened.
This is based on sha1
7cf726a59435 Linus Torvalds "Merge tag 'linux-kselftest-kunit-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest".
Please comment. Thanks.
Alexey Kardashevskiy (2):
Revert "dma-mapping: move large parts of <linux/dma-direct.h> to
kernel/dma"
powerpc/dma: Fallback to dma_ops when persistent memory present
include/linux/dma-direct.h | 106 ++++++++++++++++++++++
kernel/dma/direct.h | 119 -------------------------
arch/powerpc/kernel/dma-iommu.c | 68 +++++++++++++-
arch/powerpc/platforms/pseries/iommu.c | 41 +++++++--
kernel/dma/direct.c | 2 +-
kernel/dma/mapping.c | 2 +-
6 files changed, 207 insertions(+), 131 deletions(-)
delete mode 100644 kernel/dma/direct.h
--
2.17.1
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Finn Thain @ 2020-10-20 23:43 UTC (permalink / raw)
To: Brad Boyer
Cc: Greg KH, Laurent Vivier, linux-kernel, linux-m68k,
Geert Uytterhoeven, linux-serial, Paul Mackerras, linuxppc-dev,
Joshua Thompson
In-Reply-To: <20201020224446.GA15066@allandria.com>
On Tue, 20 Oct 2020, Brad Boyer wrote:
>
> Wouldn't it be better to rearrange this code to only run if the devices
> are present? This is a macio driver on pmac and a platform driver on
> mac, so shouldn't it be possible to only run this code when the
> appropriate entries are present in the right data structures?
>
> I didn't look at a lot of the other serial drivers, but some other mac
> drivers have recently been updated to no longer have MACH_IS_MAC checks
> due to being converted to platform drivers.
>
Actually, it's not simply a platform driver or macio driver. I think the
console is supposed to be registered before the normal bus matching takes
place. Hence this comment in pmac_zilog.c,
/*
* First, we need to do a direct OF-based probe pass. We
* do that because we want serial console up before the
* macio stuffs calls us back, and since that makes it
* easier to pass the proper number of channels to
* uart_register_driver()
*/
Laurent, can we avoid the irq == 0 warning splat like this?
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 96e7aa479961..7db600cd8cc7 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1701,8 +1701,10 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
int irq;
r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0);
+ if (!r_ports)
+ return -ENODEV;
irq = platform_get_irq(uap->pdev, 0);
- if (!r_ports || irq <= 0)
+ if (irq <= 0)
return -ENODEV;
uap->port.mapbase = r_ports->start;
^ permalink raw reply related
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Brad Boyer @ 2020-10-20 22:44 UTC (permalink / raw)
To: Laurent Vivier
Cc: Greg KH, linux-kernel, linux-m68k, Geert Uytterhoeven,
linux-serial, Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <b52e7fde-8874-3c53-ca13-7709656b69fb@vivier.eu>
On Tue, Oct 20, 2020 at 08:42:53PM +0200, Laurent Vivier wrote:
> Le 20/10/2020 ?? 20:32, Greg KH a ??crit??:
> > On Tue, Oct 20, 2020 at 08:19:26PM +0200, Laurent Vivier wrote:
> >> Le 20/10/2020 ?? 19:37, Greg KH a ??crit??:
> >>> Why not fix it to work properly like other arch checks are done
> >> I would be happy to do the same.
> >>
> >>> Put it in a .h file and do the #ifdef there. Why is this "special"?
> >>
> >> I don't know.
> >>
> >
> > Yup, that would be a good start, but why is the pmac_zilog.h file
> > responsible for this? Shouldn't this be in some arch-specific file
> > somewhere?
>
> For m68k, MACH_IS_MAC is defined in arch/m68k/include/asm/setup.h
>
> If I want to define it for any other archs I don't know in which file we
> can put it.
>
> But as m68k mac is only sharing drivers with pmac perhaps we can put
> this in arch/powerpc/include/asm/setup.h?
Wouldn't it be better to rearrange this code to only run if the devices
are present? This is a macio driver on pmac and a platform driver on mac,
so shouldn't it be possible to only run this code when the appropriate
entries are present in the right data structures?
I didn't look at a lot of the other serial drivers, but some other mac
drivers have recently been updated to no longer have MACH_IS_MAC checks
due to being converted to platform drivers.
Brad Boyer
brad@allandria.com
^ permalink raw reply
* Re: [PATCH v3 05/16] dt-bindings: usb: usb-hcd: Add generic "usb-phy" property
From: Martin Blumenstingl @ 2020-10-20 19:34 UTC (permalink / raw)
To: Serge Semin
Cc: Neil Armstrong, Bjorn Andersson, Pavel Parkhomenko, Rob Herring,
Kevin Hilman, Krzysztof Kozlowski, Andy Gross, linux-snps-arc,
devicetree, Mathias Nyman, Lad Prabhakar, Alexey Malahov,
Rob Herring, linux-arm-kernel, Roger Quadros, Felipe Balbi,
Greg Kroah-Hartman, Yoshihiro Shimoda, linux-usb, linux-mips,
Serge Semin, linux-kernel, Manu Gautam, linuxppc-dev
In-Reply-To: <20201020112101.19077-6-Sergey.Semin@baikalelectronics.ru>
On Tue, Oct 20, 2020 at 1:21 PM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> Even though the Generic PHY framework is the more preferable way of
> setting the USB PHY up, there are still many dts-files and DT bindings
> which rely on having the legacy "usb-phy" specified to attach particular
> USB PHYs to USB cores. Let's have the "usb-phy" property described in
> the generic USB HCD binding file so it would be validated against the
> nodes in which it's specified. Mark the property as deprecated to
> discourage the developers from using it.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Laurent Vivier @ 2020-10-20 18:42 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <20201020183246.GA912431@kroah.com>
Le 20/10/2020 à 20:32, Greg KH a écrit :
> On Tue, Oct 20, 2020 at 08:19:26PM +0200, Laurent Vivier wrote:
>> Le 20/10/2020 à 19:37, Greg KH a écrit :
>>> On Tue, Oct 20, 2020 at 06:37:41PM +0200, Laurent Vivier wrote:
>>>> Le 20/10/2020 à 18:28, Greg KH a écrit :
>>>>> On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
>>>>>> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
>>>>>> if kernel is built for Mac but not on a Mac.
>>>>>>
>>>>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>>>>> ---
>>>>>> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
>>>>>> 1 file changed, 11 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
>>>>>> index 063484b22523..d1d2e55983c3 100644
>>>>>> --- a/drivers/tty/serial/pmac_zilog.c
>>>>>> +++ b/drivers/tty/serial/pmac_zilog.c
>>>>>> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
>>>>>> static int __init init_pmz(void)
>>>>>> {
>>>>>> int rc, i;
>>>>>> +
>>>>>> +#ifdef CONFIG_MAC
>>>>>> + if (!MACH_IS_MAC)
>>>>>> + return -ENODEV;
>>>>>> +#endif
>>>>>
>>>>> Why is the #ifdef needed?
>>>>>
>>>>> We don't like putting #ifdef in .c files for good reasons. Can you make
>>>>> the api check for this work with and without that #ifdef needed?
>>>>
>>>> The #ifdef is needed because this file can be compiled for PowerMac and
>>>> m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the
>>>> #ifdef.
>>>>
>>>> We need the MAC_IS_MAC because the same kernel can be used with several
>>>> m68k machines, so the init_pmz can be called on a m68k machine without
>>>> the zilog device (it's a multi-targets kernel).
>>>>
>>>> You can check it's the good way to do by looking inside:
>>>>
>>>> drivers/video/fbdev/valkyriefb.c +317
>>>> drivers/macintosh/adb.c +316
>>>>
>>>> That are two files used by both, mac and pmac.
>>>
>>> Why not fix it to work properly like other arch checks are done
>> I would be happy to do the same.
>>
>>> Put it in a .h file and do the #ifdef there. Why is this "special"?
>>
>> I don't know.
>>
>> Do you mean something like:
>>
>> drivers/tty/serial/pmac_zilog.h
>> ...
>> #ifndef MACH_IS_MAC
>> #define MACH_IS_MAC (0)
>> #endif
>> ...
>>
>> drivers/tty/serial/pmac_zilog.c
>> ...
>> static int __init pmz_console_init(void)
>> {
>> if (!MACH_IS_MAC)
>> return -ENODEV;
>> ...
>
> Yup, that would be a good start, but why is the pmac_zilog.h file
> responsible for this? Shouldn't this be in some arch-specific file
> somewhere?
For m68k, MACH_IS_MAC is defined in arch/m68k/include/asm/setup.h
If I want to define it for any other archs I don't know in which file we
can put it.
But as m68k mac is only sharing drivers with pmac perhaps we can put
this in arch/powerpc/include/asm/setup.h?
Thanks,
Laurent
^ permalink raw reply
* Re: mm: Question about the use of 'accessed' flags and pte_young() helper
From: Johannes Weiner @ 2020-10-20 18:33 UTC (permalink / raw)
To: Vlastimil Babka
Cc: linux-kernel@vger.kernel.org, Nicholas Piggin, linux-mm,
linuxppc-dev@lists.ozlabs.org, Aneesh Kumar K.V
In-Reply-To: <ed3d1e19-b18b-d10e-2c86-0fb7ce3a431d@suse.cz>
On Tue, Oct 20, 2020 at 05:52:07PM +0200, Vlastimil Babka wrote:
> On 10/8/20 11:49 AM, Christophe Leroy wrote:
> > In a 10 years old commit
> > (https://github.com/linuxppc/linux/commit/d069cb4373fe0d451357c4d3769623a7564dfa9f), powerpc 8xx has
> > made the handling of PTE accessed bit conditional to CONFIG_SWAP.
> > Since then, this has been extended to some other powerpc variants.
> >
> > That commit means that when CONFIG_SWAP is not selected, the accessed bit is not set by SW TLB miss
> > handlers, leading to pte_young() returning garbage, or should I say possibly returning false
> > allthough a page has been accessed since its access flag was reset.
> >
> > Looking at various mm/ places, pte_young() is used independent of CONFIG_SWAP
> >
> > Is it still valid the not manage accessed flags when CONFIG_SWAP is not selected ?
>
> AFAIK it's wrong, reclaim needs it to detect accessed pages on inactive
> list, via page_referenced(), including file pages (page cache) where
> CONFIG_SWAP plays no role. Maybe it was different 10 years ago.
Yes, we require this bit for properly aging mmapped file pages. The
underlying assumption in the referenced commit is incorrect.
> > If yes, should pte_young() always return true in that case ?
>
> It should best work as intended. If not possible, true is maybe better, as
> false will lead to inactive file list thrashing.
An unconditional true will cause mmapped file pages to be permanently
mlocked / unevictable.
Either way will break some workloads. The only good answer is the
truth :-)
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Greg KH @ 2020-10-20 18:32 UTC (permalink / raw)
To: Laurent Vivier
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <387fd2aa-b181-c41f-0581-0a7e79a44e41@vivier.eu>
On Tue, Oct 20, 2020 at 08:19:26PM +0200, Laurent Vivier wrote:
> Le 20/10/2020 à 19:37, Greg KH a écrit :
> > On Tue, Oct 20, 2020 at 06:37:41PM +0200, Laurent Vivier wrote:
> >> Le 20/10/2020 à 18:28, Greg KH a écrit :
> >>> On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
> >>>> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
> >>>> if kernel is built for Mac but not on a Mac.
> >>>>
> >>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> >>>> ---
> >>>> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
> >>>> 1 file changed, 11 insertions(+)
> >>>>
> >>>> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> >>>> index 063484b22523..d1d2e55983c3 100644
> >>>> --- a/drivers/tty/serial/pmac_zilog.c
> >>>> +++ b/drivers/tty/serial/pmac_zilog.c
> >>>> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
> >>>> static int __init init_pmz(void)
> >>>> {
> >>>> int rc, i;
> >>>> +
> >>>> +#ifdef CONFIG_MAC
> >>>> + if (!MACH_IS_MAC)
> >>>> + return -ENODEV;
> >>>> +#endif
> >>>
> >>> Why is the #ifdef needed?
> >>>
> >>> We don't like putting #ifdef in .c files for good reasons. Can you make
> >>> the api check for this work with and without that #ifdef needed?
> >>
> >> The #ifdef is needed because this file can be compiled for PowerMac and
> >> m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the
> >> #ifdef.
> >>
> >> We need the MAC_IS_MAC because the same kernel can be used with several
> >> m68k machines, so the init_pmz can be called on a m68k machine without
> >> the zilog device (it's a multi-targets kernel).
> >>
> >> You can check it's the good way to do by looking inside:
> >>
> >> drivers/video/fbdev/valkyriefb.c +317
> >> drivers/macintosh/adb.c +316
> >>
> >> That are two files used by both, mac and pmac.
> >
> > Why not fix it to work properly like other arch checks are done
> I would be happy to do the same.
>
> > Put it in a .h file and do the #ifdef there. Why is this "special"?
>
> I don't know.
>
> Do you mean something like:
>
> drivers/tty/serial/pmac_zilog.h
> ...
> #ifndef MACH_IS_MAC
> #define MACH_IS_MAC (0)
> #endif
> ...
>
> drivers/tty/serial/pmac_zilog.c
> ...
> static int __init pmz_console_init(void)
> {
> if (!MACH_IS_MAC)
> return -ENODEV;
> ...
Yup, that would be a good start, but why is the pmac_zilog.h file
responsible for this? Shouldn't this be in some arch-specific file
somewhere?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Laurent Vivier @ 2020-10-20 18:19 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <20201020173745.GA882703@kroah.com>
Le 20/10/2020 à 19:37, Greg KH a écrit :
> On Tue, Oct 20, 2020 at 06:37:41PM +0200, Laurent Vivier wrote:
>> Le 20/10/2020 à 18:28, Greg KH a écrit :
>>> On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
>>>> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
>>>> if kernel is built for Mac but not on a Mac.
>>>>
>>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>>> ---
>>>> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
>>>> 1 file changed, 11 insertions(+)
>>>>
>>>> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
>>>> index 063484b22523..d1d2e55983c3 100644
>>>> --- a/drivers/tty/serial/pmac_zilog.c
>>>> +++ b/drivers/tty/serial/pmac_zilog.c
>>>> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
>>>> static int __init init_pmz(void)
>>>> {
>>>> int rc, i;
>>>> +
>>>> +#ifdef CONFIG_MAC
>>>> + if (!MACH_IS_MAC)
>>>> + return -ENODEV;
>>>> +#endif
>>>
>>> Why is the #ifdef needed?
>>>
>>> We don't like putting #ifdef in .c files for good reasons. Can you make
>>> the api check for this work with and without that #ifdef needed?
>>
>> The #ifdef is needed because this file can be compiled for PowerMac and
>> m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the
>> #ifdef.
>>
>> We need the MAC_IS_MAC because the same kernel can be used with several
>> m68k machines, so the init_pmz can be called on a m68k machine without
>> the zilog device (it's a multi-targets kernel).
>>
>> You can check it's the good way to do by looking inside:
>>
>> drivers/video/fbdev/valkyriefb.c +317
>> drivers/macintosh/adb.c +316
>>
>> That are two files used by both, mac and pmac.
>
> Why not fix it to work properly like other arch checks are done
I would be happy to do the same.
> Put it in a .h file and do the #ifdef there. Why is this "special"?
I don't know.
Do you mean something like:
drivers/tty/serial/pmac_zilog.h
...
#ifndef MACH_IS_MAC
#define MACH_IS_MAC (0)
#endif
...
drivers/tty/serial/pmac_zilog.c
...
static int __init pmz_console_init(void)
{
if (!MACH_IS_MAC)
return -ENODEV;
...
Thanks,
Laurent
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Greg KH @ 2020-10-20 17:37 UTC (permalink / raw)
To: Laurent Vivier
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <468bbbef-4745-3b16-b6f4-30b46ebcdc33@vivier.eu>
On Tue, Oct 20, 2020 at 06:37:41PM +0200, Laurent Vivier wrote:
> Le 20/10/2020 à 18:28, Greg KH a écrit :
> > On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
> >> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
> >> if kernel is built for Mac but not on a Mac.
> >>
> >> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> >> ---
> >> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
> >> 1 file changed, 11 insertions(+)
> >>
> >> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> >> index 063484b22523..d1d2e55983c3 100644
> >> --- a/drivers/tty/serial/pmac_zilog.c
> >> +++ b/drivers/tty/serial/pmac_zilog.c
> >> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
> >> static int __init init_pmz(void)
> >> {
> >> int rc, i;
> >> +
> >> +#ifdef CONFIG_MAC
> >> + if (!MACH_IS_MAC)
> >> + return -ENODEV;
> >> +#endif
> >
> > Why is the #ifdef needed?
> >
> > We don't like putting #ifdef in .c files for good reasons. Can you make
> > the api check for this work with and without that #ifdef needed?
>
> The #ifdef is needed because this file can be compiled for PowerMac and
> m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the
> #ifdef.
>
> We need the MAC_IS_MAC because the same kernel can be used with several
> m68k machines, so the init_pmz can be called on a m68k machine without
> the zilog device (it's a multi-targets kernel).
>
> You can check it's the good way to do by looking inside:
>
> drivers/video/fbdev/valkyriefb.c +317
> drivers/macintosh/adb.c +316
>
> That are two files used by both, mac and pmac.
Why not fix it to work properly like other arch checks are done?
Put it in a .h file and do the #ifdef there. Why is this "special"?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Laurent Vivier @ 2020-10-20 16:37 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <20201020162844.GA865546@kroah.com>
Le 20/10/2020 à 18:28, Greg KH a écrit :
> On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
>> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
>> if kernel is built for Mac but not on a Mac.
>>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>> ---
>> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
>> index 063484b22523..d1d2e55983c3 100644
>> --- a/drivers/tty/serial/pmac_zilog.c
>> +++ b/drivers/tty/serial/pmac_zilog.c
>> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
>> static int __init init_pmz(void)
>> {
>> int rc, i;
>> +
>> +#ifdef CONFIG_MAC
>> + if (!MACH_IS_MAC)
>> + return -ENODEV;
>> +#endif
>
> Why is the #ifdef needed?
>
> We don't like putting #ifdef in .c files for good reasons. Can you make
> the api check for this work with and without that #ifdef needed?
The #ifdef is needed because this file can be compiled for PowerMac and
m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the
#ifdef.
We need the MAC_IS_MAC because the same kernel can be used with several
m68k machines, so the init_pmz can be called on a m68k machine without
the zilog device (it's a multi-targets kernel).
You can check it's the good way to do by looking inside:
drivers/video/fbdev/valkyriefb.c +317
drivers/macintosh/adb.c +316
That are two files used by both, mac and pmac.
Thanks,
Laurent
^ permalink raw reply
* [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Laurent Vivier @ 2020-10-20 16:23 UTC (permalink / raw)
To: linux-kernel
Cc: Laurent Vivier, linux-m68k, Paul Mackerras, linux-serial,
Geert Uytterhoeven, linuxppc-dev, Joshua Thompson
We can avoid to probe for the Zilog device (and generate ugly kernel warning)
if kernel is built for Mac but not on a Mac.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 063484b22523..d1d2e55983c3 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
static int __init init_pmz(void)
{
int rc, i;
+
+#ifdef CONFIG_MAC
+ if (!MACH_IS_MAC)
+ return -ENODEV;
+#endif
+
printk(KERN_INFO "%s\n", version);
/*
@@ -2034,6 +2040,11 @@ static int __init pmz_console_setup(struct console *co, char *options)
static int __init pmz_console_init(void)
{
+#ifdef CONFIG_MAC
+ if (!MACH_IS_MAC)
+ return -ENODEV;
+#endif
+
/* Probe ports */
pmz_probe();
--
2.26.2
^ permalink raw reply related
* Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
From: Greg KH @ 2020-10-20 16:28 UTC (permalink / raw)
To: Laurent Vivier
Cc: linux-kernel, linux-m68k, Geert Uytterhoeven, linux-serial,
Paul Mackerras, linuxppc-dev, Joshua Thompson
In-Reply-To: <20201020162303.1730562-1-laurent@vivier.eu>
On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote:
> We can avoid to probe for the Zilog device (and generate ugly kernel warning)
> if kernel is built for Mac but not on a Mac.
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> index 063484b22523..d1d2e55983c3 100644
> --- a/drivers/tty/serial/pmac_zilog.c
> +++ b/drivers/tty/serial/pmac_zilog.c
> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = {
> static int __init init_pmz(void)
> {
> int rc, i;
> +
> +#ifdef CONFIG_MAC
> + if (!MACH_IS_MAC)
> + return -ENODEV;
> +#endif
Why is the #ifdef needed?
We don't like putting #ifdef in .c files for good reasons. Can you make
the api check for this work with and without that #ifdef needed?
thanks,
greg k-h
^ permalink raw reply
* Re: mm: Question about the use of 'accessed' flags and pte_young() helper
From: Vlastimil Babka @ 2020-10-20 15:52 UTC (permalink / raw)
To: Christophe Leroy, linux-mm, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, Aneesh Kumar K.V, Nicholas Piggin,
Johannes Weiner
In-Reply-To: <31ef1305-1fd4-8159-a2ca-e9968a568ff0@csgroup.eu>
On 10/8/20 11:49 AM, Christophe Leroy wrote:
> In a 10 years old commit
> (https://github.com/linuxppc/linux/commit/d069cb4373fe0d451357c4d3769623a7564dfa9f), powerpc 8xx has
> made the handling of PTE accessed bit conditional to CONFIG_SWAP.
> Since then, this has been extended to some other powerpc variants.
>
> That commit means that when CONFIG_SWAP is not selected, the accessed bit is not set by SW TLB miss
> handlers, leading to pte_young() returning garbage, or should I say possibly returning false
> allthough a page has been accessed since its access flag was reset.
>
> Looking at various mm/ places, pte_young() is used independent of CONFIG_SWAP
>
> Is it still valid the not manage accessed flags when CONFIG_SWAP is not selected ?
AFAIK it's wrong, reclaim needs it to detect accessed pages on inactive list,
via page_referenced(), including file pages (page cache) where CONFIG_SWAP plays
no role. Maybe it was different 10 years ago.
> If yes, should pte_young() always return true in that case ?
It should best work as intended. If not possible, true is maybe better, as false
will lead to inactive file list thrashing.
> While we are at it, I'm wondering whether powerpc should redefine arch_faults_on_old_pte()
> On some variants of powerpc, accessed flag is managed by HW. On others, it is managed by SW TLB miss
> handlers via page fault handling.
>
> Thanks
> Christophe
>
^ permalink raw reply
* Re: [PATCH v3 09/16] dt-bindings: usb: Convert DWC USB3 bindings to DT schema
From: Rob Herring @ 2020-10-20 15:40 UTC (permalink / raw)
To: Serge Semin
Cc: Neil Armstrong, linux-mips, Pavel Parkhomenko, Kevin Hilman,
Krzysztof Kozlowski, Andy Gross, linux-snps-arc, devicetree,
Mathias Nyman, Martin Blumenstingl, Lad Prabhakar, Alexey Malahov,
Rob Herring, Bjorn Andersson, linux-arm-kernel, Roger Quadros,
Felipe Balbi, Greg Kroah-Hartman, Yoshihiro Shimoda, linux-usb,
linux-kernel, Serge Semin, Manu Gautam, linuxppc-dev
In-Reply-To: <20201020112101.19077-10-Sergey.Semin@baikalelectronics.ru>
On Tue, 20 Oct 2020 14:20:54 +0300, Serge Semin wrote:
> DWC USB3 DT node is supposed to be compliant with the Generic xHCI
> Controller schema, but with additional vendor-specific properties, the
> controller-specific reference clocks and PHYs. So let's convert the
> currently available legacy text-based DWC USB3 bindings to the DT schema
> and make sure the DWC USB3 nodes are also validated against the
> usb-xhci.yaml schema.
>
> Note we have to discard the nodename restriction of being prefixed with
> "dwc3@" string, since in accordance with the usb-hcd.yaml schema USB nodes
> are supposed to be named as "^usb(@.*)".
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
>
> ---
>
> Changelog v2:
> - Discard '|' from the descriptions, since we don't need to preserve
> the text formatting in any of them.
> - Drop quotes from around the string constants.
> - Fix the "clock-names" prop description to be referring the enumerated
> clock-names instead of the ones from the Databook.
>
> Changelog v3:
> - Apply usb-xhci.yaml# schema only if the controller is supposed to work
> as either host or otg.
> ---
> .../devicetree/bindings/usb/dwc3.txt | 125 --------
> .../devicetree/bindings/usb/snps,dwc3.yaml | 302 ++++++++++++++++++
> 2 files changed, 302 insertions(+), 125 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/usb/dwc3.txt
> create mode 100644 Documentation/devicetree/bindings/usb/snps,dwc3.yaml
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH 15/29] powerpc: dts: akebono: Harmonize EHCI/OHCI DT nodes name
From: Krzysztof Kozlowski @ 2020-10-20 12:38 UTC (permalink / raw)
To: Serge Semin
Cc: Felipe Balbi, Florian Fainelli, Greg Kroah-Hartman, linux-usb,
linux-kernel, Serge Semin, devicetree, Rob Herring,
Paul Mackerras, linuxppc-dev, linux-arm-kernel
In-Reply-To: <20201020115959.2658-16-Sergey.Semin@baikalelectronics.ru>
On Tue, Oct 20, 2020 at 02:59:45PM +0300, Serge Semin wrote:
> In accordance with the Generic EHCI/OHCI bindings the corresponding node
> name is suppose to comply with the Generic USB HCD DT schema, which
> requires the USB nodes to have the name acceptable by the regexp:
> "^usb(@.*)?" . Make sure the "generic-ehci" and "generic-ohci"-compatible
> nodes are correctly named.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> ---
> arch/powerpc/boot/dts/akebono.dts | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v2 0/2] Fixes for coregroup
From: Michael Ellerman @ 2020-10-20 12:23 UTC (permalink / raw)
To: Michael Ellerman, Srikar Dronamraju
Cc: Nathan Lynch, Gautham R Shenoy, Qian Cai, LKML, Ingo Molnar,
Peter Zijlstra, linuxppc-dev, Valentin Schneider
In-Reply-To: <20201019042716.106234-1-srikar@linux.vnet.ibm.com>
On Mon, 19 Oct 2020 09:57:14 +0530, Srikar Dronamraju wrote:
> These patches fixes problems introduced by the coregroup patches.
> The first patch we remove a redundant variable.
> Second patch allows to boot with CONFIG_CPUMASK_OFFSTACK enabled.
>
> Changelog v1->v2:
> https://lore.kernel.org/linuxppc-dev/20201008034240.34059-1-srikar@linux.vnet.ibm.com/t/#u
> 1. 1st patch was not part of previous posting.
> 2. Updated 2nd patch based on comments from Michael Ellerman
>
> [...]
Applied to powerpc/fixes.
[1/2] powerpc/smp: Remove unnecessary variable
https://git.kernel.org/powerpc/c/966730a6e8524c1b5fe64358e5884605cab6ccb3
[2/2] powerpc/smp: Use GFP_ATOMIC while allocating tmp mask
https://git.kernel.org/powerpc/c/84dbf66c63472069e5eb40b810731367618cd8b5
cheers
^ permalink raw reply
* Re: [PATCH 1/2] powerpc: Fix user data corruption with P9N DD2.1 VSX CI load workaround emulation
From: Michael Ellerman @ 2020-10-20 12:23 UTC (permalink / raw)
To: Michael Neuling, mpe; +Cc: linuxppc-dev
In-Reply-To: <20201013043741.743413-1-mikey@neuling.org>
On Tue, 13 Oct 2020 15:37:40 +1100, Michael Neuling wrote:
> __get_user_atomic_128_aligned() stores to kaddr using stvx which is a
> VMX store instruction, hence kaddr must be 16 byte aligned otherwise
> the store won't occur as expected.
>
> Unfortunately when we call __get_user_atomic_128_aligned() in
> p9_hmi_special_emu(), the buffer we pass as kaddr (ie. vbuf) isn't
> guaranteed to be 16B aligned. This means that the write to vbuf in
> __get_user_atomic_128_aligned() has the bottom bits of the address
> truncated. This results in other local variables being
> overwritten. Also vbuf will not contain the correct data which results
> in the userspace emulation being wrong and hence user data corruption.
>
> [...]
Applied to powerpc/fixes.
[1/2] powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
https://git.kernel.org/powerpc/c/1da4a0272c5469169f78cd76cf175ff984f52f06
[2/2] selftests/powerpc: Make alignment handler test P9N DD2.1 vector CI load workaround
https://git.kernel.org/powerpc/c/d1781f23704707d350b8c9006e2bdf5394bf91b2
cheers
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox