* [Buildroot] [PATCH 3/5] package/libtomcrypt: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
In-Reply-To: <20200219160203.874-3-peter@korsgaard.com>
>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply
* Re: [PATCH 4/4] crypto: hisilicon/sec2 - Add pbuffer mode for SEC driver
From: Xu Zaibo @ 2020-02-20 12:16 UTC (permalink / raw)
To: John Garry, herbert, davem
Cc: qianweili, tanghui20, forest.zhouchang, linuxarm, zhangwei375,
shenyang39, yekai13, linux-crypto
In-Reply-To: <87591c1f-5c6b-64bd-5dc2-900e1481b5ca@huawei.com>
On 2020/2/20 19:07, John Garry wrote:
> On 20/02/2020 10:10, Xu Zaibo wrote:
>> Hi,
>>
>>
>> On 2020/2/20 17:50, John Garry wrote:
>>> On 20/02/2020 09:04, Zaibo Xu wrote:
>>>> From: liulongfang <liulongfang@huawei.com>
>>>>
>>>> In the scenario of SMMU translation, the SEC performance of short
>>>> messages
>>>> (<512Bytes) cannot meet our expectations. To avoid this, we reserve
>>>> the
>>>> plat buffer (PBUF) memory for small packets when creating TFM.
>>>>
>>>
>>> I haven't gone through the code here, but why not use this method
>>> also for non-translated? What are the pros and cons?
>> Because non-translated has no performance or throughput problems.
>>
>
> OK, so no problem, but I was asking could it be improved, and, if so,
> what would be the drawbacks?
>
> As for the change to check if the IOMMU is translating, it seems exact
> same as that for the hi1616 driver...
>
Currently, I find the only drawback is needing more memory :), what's
your idea?
Yes, the same as SEC V1.
Cheers,
Zaibo
.
>>
>> .
>>>
>>> The commit message is very light on details.
>>>
>>> Thanks
>>> john
>>>
>>> .
>>>
>>
>>
>> .
>
> .
>
^ permalink raw reply
* [Buildroot] [PATCH 5/5] package/ipsec-tools: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
In-Reply-To: <20200219160203.874-5-peter@korsgaard.com>
>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply
* [Buildroot] [PATCH 4/5] package/vorbis-tools: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
In-Reply-To: <20200219160203.874-4-peter@korsgaard.com>
>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply
* [Buildroot] [git commit] package/libtomcrypt: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=f80814a6a450c98fb9d1e46258aefc22c5fbabc9
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
package/libtomcrypt/libtomcrypt.mk | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/libtomcrypt/libtomcrypt.mk b/package/libtomcrypt/libtomcrypt.mk
index 583bcb15ff..c2f1babb49 100644
--- a/package/libtomcrypt/libtomcrypt.mk
+++ b/package/libtomcrypt/libtomcrypt.mk
@@ -13,6 +13,9 @@ LIBTOMCRYPT_INSTALL_STAGING = YES
LIBTOMCRYPT_INSTALL_TARGET = NO # only static library
LIBTOMCRYPT_DEPENDENCIES = libtommath
+# 0001-fix-CVE-2019-17362.patch
+LIBTOMCRYPT_IGNORE_CVES += CVE-2019-17362
+
LIBTOMCRYPT_CFLAGS = -I./src/headers $(TARGET_CFLAGS) -DLTC_SOURCE -DLTM_DESC
define LIBTOMCRYPT_BUILD_CMDS
^ permalink raw reply related
* [Buildroot] [git commit] package/vorbis-tools: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=ca9700cd628712ded750fb9d16a978d558602aa9
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
package/vorbis-tools/vorbis-tools.mk | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/package/vorbis-tools/vorbis-tools.mk b/package/vorbis-tools/vorbis-tools.mk
index 1bec1e2b96..407ea975e7 100644
--- a/package/vorbis-tools/vorbis-tools.mk
+++ b/package/vorbis-tools/vorbis-tools.mk
@@ -10,6 +10,14 @@ VORBIS_TOOLS_LICENSE = GPL-2.0
VORBIS_TOOLS_LICENSE_FILES = COPYING
VORBIS_TOOLS_DEPENDENCIES = libao libogg libvorbis libcurl
VORBIS_TOOLS_CONF_OPTS = --program-transform-name=''
+
+# 0001-oggenc-Fix-large-alloca-on-bad-AIFF-input.patch
+VORBIS_TOOLS_IGNORE_CVES += CVE-2015-6749
+# 0002-oggenc-validate-count-of-channels-in-the-header-CVE-.patch
+VORBIS_TOOLS_IGNORE_CVES += CVE-2014-9638 CVE-2014-9639
+# 0003-oggenc-fix-crash-on-raw-file-close-reported-by-Hanno.patch
+VORBIS_TOOLS_IGNORE_CVES += CVE-2014-9640
+
# ogg123 calls math functions but forgets to link with libm
VORBIS_TOOLS_CONF_ENV = LIBS=-lm
^ permalink raw reply related
* [Buildroot] [git commit] package/ipsec-tools: annotate _IGNORE_CVES for the included security patches
From: Peter Korsgaard @ 2020-02-20 12:16 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=dde8aa05b982f80febdc2837da7eaa5e79606e14
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
package/ipsec-tools/ipsec-tools.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/package/ipsec-tools/ipsec-tools.mk b/package/ipsec-tools/ipsec-tools.mk
index 634d752661..72bd8c196c 100644
--- a/package/ipsec-tools/ipsec-tools.mk
+++ b/package/ipsec-tools/ipsec-tools.mk
@@ -15,6 +15,11 @@ IPSEC_TOOLS_DEPENDENCIES = openssl flex host-pkgconf host-flex host-bison
# we patch configure.ac
IPSEC_TOOLS_AUTORECONF = YES
+# 0004-CVE-2015-4047.patch
+IPSEC_TOOLS_IGNORE_CVES += CVE-2015-4047
+# 0005-CVE-2016-10396.patch
+IPSEC_TOOLS_IGNORE_CVES += CVE-2016-10396
+
# configure hardcodes -Werror, so override CFLAGS on make invocation
IPSEC_TOOLS_MAKE_OPTS = CFLAGS='$(TARGET_CFLAGS)'
^ permalink raw reply related
* Re: [PATCH v3 04/22] x86/doublefault: Make memmove() notrace/NOKPROBE
From: Borislav Petkov @ 2020-02-20 12:17 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Steven Rostedt, linux-kernel, linux-arch, mingo, joel, gregkh,
gustavo, tglx, paulmck, josh, mathieu.desnoyers, jiangshanlai,
luto, tony.luck, frederic, dan.carpenter, mhiramat
In-Reply-To: <20200219155715.GD14946@hirez.programming.kicks-ass.net>
On Wed, Feb 19, 2020 at 04:57:15PM +0100, Peter Zijlstra wrote:
> - memmove(&gpregs->ip, (void *)regs->sp, 5*8);
> + for (i = 0; i < count; i++) {
> + int idx = (dst <= src) ? i : count - i;
> + dst[idx] = src[idx];
> + }
Or, you can actually unroll it. This way it even documents clearly what
it does:
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index fe38015ed50a..2b790a574ba5 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -298,6 +298,7 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsign
regs->ip == (unsigned long)native_irq_return_iret)
{
struct pt_regs *gpregs = (struct pt_regs *)this_cpu_read(cpu_tss_rw.x86_tss.sp0) - 1;
+ unsigned long *p = (unsigned long *)regs->sp;
/*
* regs->sp points to the failing IRET frame on the
@@ -305,7 +306,11 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsign
* in gpregs->ss through gpregs->ip.
*
*/
- memmove(&gpregs->ip, (void *)regs->sp, 5*8);
+ gpregs->ip = *p;
+ gpregs->cs = *(p + 1);
+ gpregs->flags = *(p + 2);
+ gpregs->sp = *(p + 3);
+ gpregs->ss = *(p + 4);
gpregs->orig_ax = 0; /* Missing (lost) #GP error code */
/*
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply related
* [PATCH 0/3] Unified Broadcom NAND controller for ARM
From: Nicolas Heemeryck @ 2020-02-20 12:18 UTC (permalink / raw)
To: u-boot
This serie of patches attempts to merge all Broadcom nand controllers into one.
It will avoid code duplication.
Cc: Phillipe Reynes <philippe.reynes@softathome.com>
Nicolas Heemeryck (3):
nand: brcmnand: add bcmbca support
configs: use unified bcmbca nand controller
brcmnand: drop arch specific nand controller
configs/bcm963158_ram_defconfig | 2 +-
configs/bcm968360bg_ram_defconfig | 2 +-
configs/bcm968580xref_ram_defconfig | 2 +-
drivers/mtd/nand/raw/Kconfig | 20 +--
drivers/mtd/nand/raw/brcmnand/Makefile | 4 +-
drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c | 124 ------------------
drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c | 123 -----------------
drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c | 124 ------------------
drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 124 ++++++++++++++++++
9 files changed, 132 insertions(+), 393 deletions(-)
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
create mode 100644 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
--
2.20.1
^ permalink raw reply
* [PATCH 1/3] nand: brcmnand: add bcmbca support
From: Nicolas Heemeryck @ 2020-02-20 12:18 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20200220121808.15970-1-nicolas.heemeryck@gmail.com>
Almost all Broadcom BCA (Broadband Carrier Access) platforms based on
ARM use the same nand controller.
So rather than adding a bcm6xxx_nand.c per Broadcom SoC, use a unified
nand controller based on the existing one and selectable through
NAND_BRCMNAND_BCMBCA.
The bcmbca controller should support all ARM based bcm63xxx, bcm68xx,
bcm67xx and bcm490x SoCs.
Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@gmail.com>
Cc: Philippe Reynes <philippe.reynes@softathome.com>
---
drivers/mtd/nand/raw/Kconfig | 6 +
drivers/mtd/nand/raw/brcmnand/Makefile | 1 +
drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 124 ++++++++++++++++++++
3 files changed, 131 insertions(+)
create mode 100644 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 23201ca720..c37e2e96c2 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -102,6 +102,12 @@ config NAND_BRCMNAND_63158
help
Enable support for broadcom nand driver on bcm63158.
+config NAND_BRCMNAND_BCMBCA
+ bool "Support Broadcom NAND controller for BCA platforms"
+ depends on NAND_BRCMNAND && (ARM64 || CPU_V7A)
+ help
+ Enable support for broadcom nand driver for BCA platforms.
+
config NAND_DAVINCI
bool "Support TI Davinci NAND controller"
help
diff --git a/drivers/mtd/nand/raw/brcmnand/Makefile b/drivers/mtd/nand/raw/brcmnand/Makefile
index 5d9e7e3f3b..61203bf5ff 100644
--- a/drivers/mtd/nand/raw/brcmnand/Makefile
+++ b/drivers/mtd/nand/raw/brcmnand/Makefile
@@ -5,5 +5,6 @@ obj-$(CONFIG_NAND_BRCMNAND_63158) += bcm63158_nand.o
obj-$(CONFIG_NAND_BRCMNAND_68360) += bcm68360_nand.o
obj-$(CONFIG_NAND_BRCMNAND_6838) += bcm6838_nand.o
obj-$(CONFIG_NAND_BRCMNAND_6858) += bcm6858_nand.o
+obj-$(CONFIG_NAND_BRCMNAND_BCMBCA) += bcmbca_nand.o
obj-$(CONFIG_NAND_BRCMNAND) += brcmnand.o
obj-$(CONFIG_NAND_BRCMNAND) += brcmnand_compat.o
diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
new file mode 100644
index 0000000000..91b0a33397
--- /dev/null
+++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <asm/io.h>
+#include <memalign.h>
+#include <nand.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <dm.h>
+
+#include "brcmnand.h"
+
+struct bcmbca_nand_soc {
+ struct brcmnand_soc soc;
+ void __iomem *base;
+};
+
+#define BCMBCA_NAND_INT 0x00
+#define BCMBCA_NAND_STATUS_SHIFT 0
+#define BCMBCA_NAND_STATUS_MASK (0xfff << BCMBCA_NAND_STATUS_SHIFT)
+
+#define BCMBCA_NAND_INT_EN 0x04
+#define BCMBCA_NAND_ENABLE_SHIFT 0
+#define BCMBCA_NAND_ENABLE_MASK (0xffff << BCMBCA_NAND_ENABLE_SHIFT)
+
+enum {
+ BCMBCA_NP_READ = BIT(0),
+ BCMBCA_BLOCK_ERASE = BIT(1),
+ BCMBCA_COPY_BACK = BIT(2),
+ BCMBCA_PAGE_PGM = BIT(3),
+ BCMBCA_CTRL_READY = BIT(4),
+ BCMBCA_DEV_RBPIN = BIT(5),
+ BCMBCA_ECC_ERR_UNC = BIT(6),
+ BCMBCA_ECC_ERR_CORR = BIT(7),
+};
+
+static bool bcmbca_nand_intc_ack(struct brcmnand_soc *soc)
+{
+ struct bcmbca_nand_soc *priv =
+ container_of(soc, struct bcmbca_nand_soc, soc);
+ void __iomem *mmio = priv->base + BCMBCA_NAND_INT;
+ u32 val = brcmnand_readl(mmio);
+
+ if (val & (BCMBCA_CTRL_READY << BCMBCA_NAND_STATUS_SHIFT)) {
+ /* Ack interrupt */
+ val &= ~BCMBCA_NAND_STATUS_MASK;
+ val |= BCMBCA_CTRL_READY << BCMBCA_NAND_STATUS_SHIFT;
+ brcmnand_writel(val, mmio);
+ return true;
+ }
+
+ return false;
+}
+
+static void bcmbca_nand_intc_set(struct brcmnand_soc *soc, bool en)
+{
+ struct bcmbca_nand_soc *priv =
+ container_of(soc, struct bcmbca_nand_soc, soc);
+ void __iomem *mmio = priv->base + BCMBCA_NAND_INT_EN;
+ u32 val = brcmnand_readl(mmio);
+
+ /* Don't ack any interrupts */
+ val &= ~BCMBCA_NAND_STATUS_MASK;
+
+ if (en)
+ val |= BCMBCA_CTRL_READY << BCMBCA_NAND_ENABLE_SHIFT;
+ else
+ val &= ~(BCMBCA_CTRL_READY << BCMBCA_NAND_ENABLE_SHIFT);
+
+ brcmnand_writel(val, mmio);
+}
+
+static int bcmbca_nand_probe(struct udevice *dev)
+{
+ struct udevice *pdev = dev;
+ struct bcmbca_nand_soc *priv = dev_get_priv(dev);
+ struct brcmnand_soc *soc;
+ struct resource res;
+
+ soc = &priv->soc;
+
+ dev_read_resource_byname(pdev, "nand-int-base", &res);
+ priv->base = devm_ioremap(dev, res.start, resource_size(&res));
+ if (IS_ERR(priv->base))
+ return PTR_ERR(priv->base);
+
+ soc->ctlrdy_ack = bcmbca_nand_intc_ack;
+ soc->ctlrdy_set_enabled = bcmbca_nand_intc_set;
+
+ /* Disable and ack all interrupts */
+ brcmnand_writel(0, priv->base + BCMBCA_NAND_INT_EN);
+ brcmnand_writel(0, priv->base + BCMBCA_NAND_INT);
+
+ return brcmnand_probe(pdev, soc);
+}
+
+static const struct udevice_id bcmbca_nand_dt_ids[] = {
+ { .compatible = "brcm,nand-bcmbca" },
+ { .compatible = "brcm,nand-bcm63158" },
+ { .compatible = "brcm,nand-bcm68360" },
+ { .compatible = "brcm,nand-bcm6858" },
+ { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(bcmbca_nand) = {
+ .name = "bcmbca-nand",
+ .id = UCLASS_MTD,
+ .of_match = bcmbca_nand_dt_ids,
+ .probe = bcmbca_nand_probe,
+ .priv_auto_alloc_size = sizeof(struct bcmbca_nand_soc),
+};
+
+void board_nand_init(void)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device_by_driver(UCLASS_MTD,
+ DM_GET_DRIVER(bcmbca_nand), &dev);
+ if (ret && ret != -ENODEV)
+ pr_err("Failed to initialize %s. (error %d)\n", dev->name,
+ ret);
+}
--
2.20.1
^ permalink raw reply related
* [PATCH 2/3] configs: use unified bcmbca nand controller
From: Nicolas Heemeryck @ 2020-02-20 12:18 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20200220121808.15970-1-nicolas.heemeryck@gmail.com>
Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@gmail.com>
Cc: Philippe Reynes <philippe.reynes@softathome.com>
---
configs/bcm963158_ram_defconfig | 2 +-
configs/bcm968360bg_ram_defconfig | 2 +-
configs/bcm968580xref_ram_defconfig | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configs/bcm963158_ram_defconfig b/configs/bcm963158_ram_defconfig
index 5cf32d52cf..91722384f8 100644
--- a/configs/bcm963158_ram_defconfig
+++ b/configs/bcm963158_ram_defconfig
@@ -40,7 +40,7 @@ CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_NAND_BRCMNAND=y
-CONFIG_NAND_BRCMNAND_63158=y
+CONFIG_NAND_BRCMNAND_BCMBCA=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPECIFY_CONSOLE_INDEX=y
diff --git a/configs/bcm968360bg_ram_defconfig b/configs/bcm968360bg_ram_defconfig
index bc3134ff29..e0fe8fa7fe 100644
--- a/configs/bcm968360bg_ram_defconfig
+++ b/configs/bcm968360bg_ram_defconfig
@@ -36,7 +36,7 @@ CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_NAND_BRCMNAND=y
-CONFIG_NAND_BRCMNAND_68360=y
+CONFIG_NAND_BRCMNAND_BCMBCA=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_SFDP_SUPPORT=y
CONFIG_SPI_FLASH_MACRONIX=y
diff --git a/configs/bcm968580xref_ram_defconfig b/configs/bcm968580xref_ram_defconfig
index c158a7c47c..9cc527d2ce 100644
--- a/configs/bcm968580xref_ram_defconfig
+++ b/configs/bcm968580xref_ram_defconfig
@@ -36,7 +36,7 @@ CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_NAND_BRCMNAND=y
-CONFIG_NAND_BRCMNAND_6858=y
+CONFIG_NAND_BRCMNAND_BCMBCA=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_SFDP_SUPPORT=y
CONFIG_SPI_FLASH_MACRONIX=y
--
2.20.1
^ permalink raw reply related
* [PATCH 3/3] brcmnand: drop arch specific nand controller
From: Nicolas Heemeryck @ 2020-02-20 12:18 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20200220121808.15970-1-nicolas.heemeryck@gmail.com>
Use instead the unified bcmbca controller.
Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@gmail.com>
Cc: Philippe Reynes <philippe.reynes@softathome.com>
---
drivers/mtd/nand/raw/Kconfig | 18 ---
drivers/mtd/nand/raw/brcmnand/Makefile | 3 -
drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c | 124 ------------------
drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c | 123 -----------------
drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c | 124 ------------------
5 files changed, 392 deletions(-)
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index c37e2e96c2..02e00e3fe6 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -78,30 +78,12 @@ config NAND_BRCMNAND_6368
help
Enable support for broadcom nand driver on bcm6368.
-config NAND_BRCMNAND_68360
- bool "Support Broadcom NAND controller on bcm68360"
- depends on NAND_BRCMNAND && ARCH_BCM68360
- help
- Enable support for broadcom nand driver on bcm68360.
-
config NAND_BRCMNAND_6838
bool "Support Broadcom NAND controller on bcm6838"
depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
help
Enable support for broadcom nand driver on bcm6838.
-config NAND_BRCMNAND_6858
- bool "Support Broadcom NAND controller on bcm6858"
- depends on NAND_BRCMNAND && ARCH_BCM6858
- help
- Enable support for broadcom nand driver on bcm6858.
-
-config NAND_BRCMNAND_63158
- bool "Support Broadcom NAND controller on bcm63158"
- depends on NAND_BRCMNAND && ARCH_BCM63158
- help
- Enable support for broadcom nand driver on bcm63158.
-
config NAND_BRCMNAND_BCMBCA
bool "Support Broadcom NAND controller for BCA platforms"
depends on NAND_BRCMNAND && (ARM64 || CPU_V7A)
diff --git a/drivers/mtd/nand/raw/brcmnand/Makefile b/drivers/mtd/nand/raw/brcmnand/Makefile
index 61203bf5ff..ad9e1d50a6 100644
--- a/drivers/mtd/nand/raw/brcmnand/Makefile
+++ b/drivers/mtd/nand/raw/brcmnand/Makefile
@@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+
obj-$(CONFIG_NAND_BRCMNAND_6368) += bcm6368_nand.o
-obj-$(CONFIG_NAND_BRCMNAND_63158) += bcm63158_nand.o
-obj-$(CONFIG_NAND_BRCMNAND_68360) += bcm68360_nand.o
obj-$(CONFIG_NAND_BRCMNAND_6838) += bcm6838_nand.o
-obj-$(CONFIG_NAND_BRCMNAND_6858) += bcm6858_nand.o
obj-$(CONFIG_NAND_BRCMNAND_BCMBCA) += bcmbca_nand.o
obj-$(CONFIG_NAND_BRCMNAND) += brcmnand.o
obj-$(CONFIG_NAND_BRCMNAND) += brcmnand_compat.o
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
deleted file mode 100644
index ea7c65a1f6..0000000000
--- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-
-#include <common.h>
-#include <asm/io.h>
-#include <memalign.h>
-#include <nand.h>
-#include <linux/err.h>
-#include <linux/errno.h>
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <dm.h>
-
-#include "brcmnand.h"
-
-struct bcm63158_nand_soc {
- struct brcmnand_soc soc;
- void __iomem *base;
-};
-
-#define BCM63158_NAND_INT 0x00
-#define BCM63158_NAND_STATUS_SHIFT 0
-#define BCM63158_NAND_STATUS_MASK (0xfff << BCM63158_NAND_STATUS_SHIFT)
-
-#define BCM63158_NAND_INT_EN 0x04
-#define BCM63158_NAND_ENABLE_SHIFT 0
-#define BCM63158_NAND_ENABLE_MASK (0xffff << BCM63158_NAND_ENABLE_SHIFT)
-
-enum {
- BCM63158_NP_READ = BIT(0),
- BCM63158_BLOCK_ERASE = BIT(1),
- BCM63158_COPY_BACK = BIT(2),
- BCM63158_PAGE_PGM = BIT(3),
- BCM63158_CTRL_READY = BIT(4),
- BCM63158_DEV_RBPIN = BIT(5),
- BCM63158_ECC_ERR_UNC = BIT(6),
- BCM63158_ECC_ERR_CORR = BIT(7),
-};
-
-static bool bcm63158_nand_intc_ack(struct brcmnand_soc *soc)
-{
- struct bcm63158_nand_soc *priv =
- container_of(soc, struct bcm63158_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM63158_NAND_INT;
- u32 val = brcmnand_readl(mmio);
-
- if (val & (BCM63158_CTRL_READY << BCM63158_NAND_STATUS_SHIFT)) {
- /* Ack interrupt */
- val &= ~BCM63158_NAND_STATUS_MASK;
- val |= BCM63158_CTRL_READY << BCM63158_NAND_STATUS_SHIFT;
- brcmnand_writel(val, mmio);
- return true;
- }
-
- return false;
-}
-
-static void bcm63158_nand_intc_set(struct brcmnand_soc *soc, bool en)
-{
- struct bcm63158_nand_soc *priv =
- container_of(soc, struct bcm63158_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM63158_NAND_INT_EN;
- u32 val = brcmnand_readl(mmio);
-
- /* Don't ack any interrupts */
- val &= ~BCM63158_NAND_STATUS_MASK;
-
- if (en)
- val |= BCM63158_CTRL_READY << BCM63158_NAND_ENABLE_SHIFT;
- else
- val &= ~(BCM63158_CTRL_READY << BCM63158_NAND_ENABLE_SHIFT);
-
- brcmnand_writel(val, mmio);
-}
-
-static int bcm63158_nand_probe(struct udevice *dev)
-{
- struct udevice *pdev = dev;
- struct bcm63158_nand_soc *priv = dev_get_priv(dev);
- struct brcmnand_soc *soc;
- struct resource res;
-
- soc = &priv->soc;
-
- dev_read_resource_byname(pdev, "nand-int-base", &res);
- priv->base = devm_ioremap(dev, res.start, resource_size(&res));
- if (IS_ERR(priv->base))
- return PTR_ERR(priv->base);
-
- soc->ctlrdy_ack = bcm63158_nand_intc_ack;
- soc->ctlrdy_set_enabled = bcm63158_nand_intc_set;
-
- /* Disable and ack all interrupts */
- brcmnand_writel(0, priv->base + BCM63158_NAND_INT_EN);
- brcmnand_writel(0, priv->base + BCM63158_NAND_INT);
-
- return brcmnand_probe(pdev, soc);
-}
-
-static const struct udevice_id bcm63158_nand_dt_ids[] = {
- {
- .compatible = "brcm,nand-bcm63158",
- },
- { /* sentinel */ }
-};
-
-U_BOOT_DRIVER(bcm63158_nand) = {
- .name = "bcm63158-nand",
- .id = UCLASS_MTD,
- .of_match = bcm63158_nand_dt_ids,
- .probe = bcm63158_nand_probe,
- .priv_auto_alloc_size = sizeof(struct bcm63158_nand_soc),
-};
-
-void board_nand_init(void)
-{
- struct udevice *dev;
- int ret;
-
- ret = uclass_get_device_by_driver(UCLASS_MTD,
- DM_GET_DRIVER(bcm63158_nand), &dev);
- if (ret && ret != -ENODEV)
- pr_err("Failed to initialize %s. (error %d)\n", dev->name,
- ret);
-}
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
deleted file mode 100644
index 0f1a28e476..0000000000
--- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
+++ /dev/null
@@ -1,123 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-
-#include <common.h>
-#include <asm/io.h>
-#include <memalign.h>
-#include <nand.h>
-#include <linux/errno.h>
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <dm.h>
-
-#include "brcmnand.h"
-
-struct bcm68360_nand_soc {
- struct brcmnand_soc soc;
- void __iomem *base;
-};
-
-#define BCM68360_NAND_INT 0x00
-#define BCM68360_NAND_STATUS_SHIFT 0
-#define BCM68360_NAND_STATUS_MASK (0xfff << BCM68360_NAND_STATUS_SHIFT)
-
-#define BCM68360_NAND_INT_EN 0x04
-#define BCM68360_NAND_ENABLE_SHIFT 0
-#define BCM68360_NAND_ENABLE_MASK (0xffff << BCM68360_NAND_ENABLE_SHIFT)
-
-enum {
- BCM68360_NP_READ = BIT(0),
- BCM68360_BLOCK_ERASE = BIT(1),
- BCM68360_COPY_BACK = BIT(2),
- BCM68360_PAGE_PGM = BIT(3),
- BCM68360_CTRL_READY = BIT(4),
- BCM68360_DEV_RBPIN = BIT(5),
- BCM68360_ECC_ERR_UNC = BIT(6),
- BCM68360_ECC_ERR_CORR = BIT(7),
-};
-
-static bool bcm68360_nand_intc_ack(struct brcmnand_soc *soc)
-{
- struct bcm68360_nand_soc *priv =
- container_of(soc, struct bcm68360_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM68360_NAND_INT;
- u32 val = brcmnand_readl(mmio);
-
- if (val & (BCM68360_CTRL_READY << BCM68360_NAND_STATUS_SHIFT)) {
- /* Ack interrupt */
- val &= ~BCM68360_NAND_STATUS_MASK;
- val |= BCM68360_CTRL_READY << BCM68360_NAND_STATUS_SHIFT;
- brcmnand_writel(val, mmio);
- return true;
- }
-
- return false;
-}
-
-static void bcm68360_nand_intc_set(struct brcmnand_soc *soc, bool en)
-{
- struct bcm68360_nand_soc *priv =
- container_of(soc, struct bcm68360_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM68360_NAND_INT_EN;
- u32 val = brcmnand_readl(mmio);
-
- /* Don't ack any interrupts */
- val &= ~BCM68360_NAND_STATUS_MASK;
-
- if (en)
- val |= BCM68360_CTRL_READY << BCM68360_NAND_ENABLE_SHIFT;
- else
- val &= ~(BCM68360_CTRL_READY << BCM68360_NAND_ENABLE_SHIFT);
-
- brcmnand_writel(val, mmio);
-}
-
-static int bcm68360_nand_probe(struct udevice *dev)
-{
- struct udevice *pdev = dev;
- struct bcm68360_nand_soc *priv = dev_get_priv(dev);
- struct brcmnand_soc *soc;
- struct resource res;
-
- soc = &priv->soc;
-
- dev_read_resource_byname(pdev, "nand-int-base", &res);
- priv->base = devm_ioremap(dev, res.start, resource_size(&res));
- if (IS_ERR(priv->base))
- return PTR_ERR(priv->base);
-
- soc->ctlrdy_ack = bcm68360_nand_intc_ack;
- soc->ctlrdy_set_enabled = bcm68360_nand_intc_set;
-
- /* Disable and ack all interrupts */
- brcmnand_writel(0, priv->base + BCM68360_NAND_INT_EN);
- brcmnand_writel(0, priv->base + BCM68360_NAND_INT);
-
- return brcmnand_probe(pdev, soc);
-}
-
-static const struct udevice_id bcm68360_nand_dt_ids[] = {
- {
- .compatible = "brcm,nand-bcm68360",
- },
- { /* sentinel */ }
-};
-
-U_BOOT_DRIVER(bcm68360_nand) = {
- .name = "bcm68360-nand",
- .id = UCLASS_MTD,
- .of_match = bcm68360_nand_dt_ids,
- .probe = bcm68360_nand_probe,
- .priv_auto_alloc_size = sizeof(struct bcm68360_nand_soc),
-};
-
-void board_nand_init(void)
-{
- struct udevice *dev;
- int ret;
-
- ret = uclass_get_device_by_driver(UCLASS_MTD,
- DM_GET_DRIVER(bcm68360_nand), &dev);
- if (ret && ret != -ENODEV)
- pr_err("Failed to initialize %s. (error %d)\n", dev->name,
- ret);
-}
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
deleted file mode 100644
index 6aca011db2..0000000000
--- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-
-#include <common.h>
-#include <asm/io.h>
-#include <memalign.h>
-#include <nand.h>
-#include <linux/err.h>
-#include <linux/errno.h>
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <dm.h>
-
-#include "brcmnand.h"
-
-struct bcm6858_nand_soc {
- struct brcmnand_soc soc;
- void __iomem *base;
-};
-
-#define BCM6858_NAND_INT 0x00
-#define BCM6858_NAND_STATUS_SHIFT 0
-#define BCM6858_NAND_STATUS_MASK (0xfff << BCM6858_NAND_STATUS_SHIFT)
-
-#define BCM6858_NAND_INT_EN 0x04
-#define BCM6858_NAND_ENABLE_SHIFT 0
-#define BCM6858_NAND_ENABLE_MASK (0xffff << BCM6858_NAND_ENABLE_SHIFT)
-
-enum {
- BCM6858_NP_READ = BIT(0),
- BCM6858_BLOCK_ERASE = BIT(1),
- BCM6858_COPY_BACK = BIT(2),
- BCM6858_PAGE_PGM = BIT(3),
- BCM6858_CTRL_READY = BIT(4),
- BCM6858_DEV_RBPIN = BIT(5),
- BCM6858_ECC_ERR_UNC = BIT(6),
- BCM6858_ECC_ERR_CORR = BIT(7),
-};
-
-static bool bcm6858_nand_intc_ack(struct brcmnand_soc *soc)
-{
- struct bcm6858_nand_soc *priv =
- container_of(soc, struct bcm6858_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM6858_NAND_INT;
- u32 val = brcmnand_readl(mmio);
-
- if (val & (BCM6858_CTRL_READY << BCM6858_NAND_STATUS_SHIFT)) {
- /* Ack interrupt */
- val &= ~BCM6858_NAND_STATUS_MASK;
- val |= BCM6858_CTRL_READY << BCM6858_NAND_STATUS_SHIFT;
- brcmnand_writel(val, mmio);
- return true;
- }
-
- return false;
-}
-
-static void bcm6858_nand_intc_set(struct brcmnand_soc *soc, bool en)
-{
- struct bcm6858_nand_soc *priv =
- container_of(soc, struct bcm6858_nand_soc, soc);
- void __iomem *mmio = priv->base + BCM6858_NAND_INT_EN;
- u32 val = brcmnand_readl(mmio);
-
- /* Don't ack any interrupts */
- val &= ~BCM6858_NAND_STATUS_MASK;
-
- if (en)
- val |= BCM6858_CTRL_READY << BCM6858_NAND_ENABLE_SHIFT;
- else
- val &= ~(BCM6858_CTRL_READY << BCM6858_NAND_ENABLE_SHIFT);
-
- brcmnand_writel(val, mmio);
-}
-
-static int bcm6858_nand_probe(struct udevice *dev)
-{
- struct udevice *pdev = dev;
- struct bcm6858_nand_soc *priv = dev_get_priv(dev);
- struct brcmnand_soc *soc;
- struct resource res;
-
- soc = &priv->soc;
-
- dev_read_resource_byname(pdev, "nand-int-base", &res);
- priv->base = devm_ioremap(dev, res.start, resource_size(&res));
- if (IS_ERR(priv->base))
- return PTR_ERR(priv->base);
-
- soc->ctlrdy_ack = bcm6858_nand_intc_ack;
- soc->ctlrdy_set_enabled = bcm6858_nand_intc_set;
-
- /* Disable and ack all interrupts */
- brcmnand_writel(0, priv->base + BCM6858_NAND_INT_EN);
- brcmnand_writel(0, priv->base + BCM6858_NAND_INT);
-
- return brcmnand_probe(pdev, soc);
-}
-
-static const struct udevice_id bcm6858_nand_dt_ids[] = {
- {
- .compatible = "brcm,nand-bcm6858",
- },
- { /* sentinel */ }
-};
-
-U_BOOT_DRIVER(bcm6858_nand) = {
- .name = "bcm6858-nand",
- .id = UCLASS_MTD,
- .of_match = bcm6858_nand_dt_ids,
- .probe = bcm6858_nand_probe,
- .priv_auto_alloc_size = sizeof(struct bcm6858_nand_soc),
-};
-
-void board_nand_init(void)
-{
- struct udevice *dev;
- int ret;
-
- ret = uclass_get_device_by_driver(UCLASS_MTD,
- DM_GET_DRIVER(bcm6858_nand), &dev);
- if (ret && ret != -ENODEV)
- pr_err("Failed to initialize %s. (error %d)\n", dev->name,
- ret);
-}
--
2.20.1
^ permalink raw reply related
* [PATCH v2 0/8] bootconfig: Update for the recent reports
From: Masami Hiramatsu @ 2020-02-20 12:18 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
Hello,
Here is the 2nd version of the bootconfig updates. There are
several implementation changes and syntax fix/updates.
This version changed a bit in Kconfig and init/main.c.
- [1/8] Use pr_warn() for warning message.
Remove unneeded "default n" line from Kconfig.
- [2/8][4/8] Update Kconfig comment. (data on initrd)
Thank you,
---
Masami Hiramatsu (8):
bootconfig: Set CONFIG_BOOT_CONFIG=n by default
bootconfig: Add bootconfig magic word for indicating bootconfig explicitly
tools/bootconfig: Remove unneeded error message silencer
bootconfig: Remove unneeded checksum
bootconfig: Reject subkey and value on same parent key
bootconfig: Overwrite value on same key by default
bootconfig: Add append value operator support
bootconfig: Print array as multiple commands for legacy command line
Documentation/admin-guide/bootconfig.rst | 37 +++++++++++-
include/linux/bootconfig.h | 3 +
init/Kconfig | 3 -
init/main.c | 54 +++++++-----------
kernel/trace/Kconfig | 3 +
lib/bootconfig.c | 44 +++++++++++----
tools/bootconfig/include/linux/printk.h | 5 --
tools/bootconfig/main.c | 77 +++++++++++---------------
tools/bootconfig/samples/bad-mixed-kv1.bconf | 3 +
tools/bootconfig/samples/bad-mixed-kv2.bconf | 3 +
tools/bootconfig/test-bootconfig.sh | 31 +++++++++-
11 files changed, 164 insertions(+), 99 deletions(-)
create mode 100644 tools/bootconfig/samples/bad-mixed-kv1.bconf
create mode 100644 tools/bootconfig/samples/bad-mixed-kv2.bconf
--
Masami Hiramatsu (Linaro) <mhiramat@kernel.org>
^ permalink raw reply
* Re: [PATCH v2 02/42] KVM: s390/interrupt: do not pin adapter interrupt pages
From: David Hildenbrand @ 2020-02-20 12:18 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank
Cc: KVM, Cornelia Huck, Thomas Huth, Ulrich Weigand, Claudio Imbrenda,
linux-s390, Michael Mueller, Vasily Gorbik
In-Reply-To: <073d3666-480e-5ba5-a46b-4cbd615f4174@redhat.com>
On 17.02.20 10:43, David Hildenbrand wrote:
> On 14.02.20 23:26, Christian Borntraeger wrote:
>> From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
>>
>> The adapter interrupt page containing the indicator bits is currently
>> pinned. That means that a guest with many devices can pin a lot of
>> memory pages in the host. This also complicates the reference tracking
>> which is needed for memory management handling of protected virtual
>> machines. It might also have some strange side effects for madvise
>> MADV_DONTNEED and other things.
>>
>> We can simply try to get the userspace page set the bits and free the
>> page. By storing the userspace address in the irq routing entry instead
>> of the guest address we can actually avoid many lookups and list walks
>> so that this variant is very likely not slower.
>>
>> If userspace messes around with the memory slots the worst thing that
>> can happen is that we write to some other memory within that process.
>> As we get the the page with FOLL_WRITE this can also not be used to
>> write to shared read-only pages.
>>
>> Signed-off-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
>> [borntraeger@de.ibm.com: patch simplification]
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>> Documentation/virt/kvm/devices/s390_flic.rst | 11 +-
>> arch/s390/include/asm/kvm_host.h | 3 -
>> arch/s390/kvm/interrupt.c | 170 ++++++-------------
>> 3 files changed, 53 insertions(+), 131 deletions(-)
>>
>> diff --git a/Documentation/virt/kvm/devices/s390_flic.rst b/Documentation/virt/kvm/devices/s390_flic.rst
>> index 954190da7d04..ea96559ba501 100644
>> --- a/Documentation/virt/kvm/devices/s390_flic.rst
>> +++ b/Documentation/virt/kvm/devices/s390_flic.rst
>> @@ -108,16 +108,9 @@ Groups:
>> mask or unmask the adapter, as specified in mask
>>
>> KVM_S390_IO_ADAPTER_MAP
>> - perform a gmap translation for the guest address provided in addr,
>> - pin a userspace page for the translated address and add it to the
>> - list of mappings
>> -
>> - .. note:: A new mapping will be created unconditionally; therefore,
>> - the calling code should avoid making duplicate mappings.
>> -
>> + This is now a no-op. The mapping is purely done by the irq route.
>> KVM_S390_IO_ADAPTER_UNMAP
>> - release a userspace page for the translated address specified in addr
>> - from the list of mappings
>> + This is now a no-op. The mapping is purely done by the irq route.
>>
>
> The interface should have accepted a hva from the very start and not
> guest addresses ...
>
> [...]
>
>>
>> static int modify_io_adapter(struct kvm_device *dev,
>> @@ -2456,12 +2378,13 @@ static int modify_io_adapter(struct kvm_device *dev,
>> if (ret > 0)
>> ret = 0;
>> break;
>> + /*
>> + * We resolve the gpa to hva when setting the IRQ routing. the set_irq
>> + * code uses get_user_pages_remote to do the actual write.
>
> nit: "get_user_pages_remote()"
>
>> + */
>> case KVM_S390_IO_ADAPTER_MAP:
>> - ret = kvm_s390_adapter_map(dev->kvm, req.id, req.addr);
>> - break;
>> case KVM_S390_IO_ADAPTER_UNMAP:
>> - ret = kvm_s390_adapter_unmap(dev->kvm, req.id, req.addr);
>> - break;
>> + return 0;
>> default:
>> ret = -EINVAL;
>> }
>> @@ -2699,19 +2622,21 @@ static unsigned long get_ind_bit(__u64 addr, unsigned long bit_nr, bool swap)
>> return swap ? (bit ^ (BITS_PER_LONG - 1)) : bit;
>> }
>>
>> -static struct s390_map_info *get_map_info(struct s390_io_adapter *adapter,
>> - u64 addr)
>> +static struct page *get_map_page(struct kvm *kvm,
>> + struct s390_io_adapter *adapter,
>> + u64 uaddr)
>> {
>> - struct s390_map_info *map;
>> + struct page *page = NULL;
>>
>> if (!adapter)
>> return NULL;
>
> AFAIKs, this check is not necessary.
>
>> -
>> - list_for_each_entry(map, &adapter->maps, list) {
>> - if (map->guest_addr == addr)
>> - return map;
>> - }
>> - return NULL;
>> + if (!uaddr)
>> + return NULL;
>
> I do wonder if that check is necessary. I don't think so but might be
> missing something.
>
>> + down_read(&kvm->mm->mmap_sem);
>> + get_user_pages_remote(NULL, kvm->mm, uaddr, 1, FOLL_WRITE,
>> + &page, NULL, NULL);
>> + up_read(&kvm->mm->mmap_sem);
>> + return page;
>> }
>>
>> static int adapter_indicators_set(struct kvm *kvm,
>> @@ -2720,30 +2645,35 @@ static int adapter_indicators_set(struct kvm *kvm,
>> {
>> unsigned long bit;
>> int summary_set, idx;
>> - struct s390_map_info *info;
>> + struct page *ind_page, *summary_page;
>> void *map;
>>
>> - info = get_map_info(adapter, adapter_int->ind_addr);
>> - if (!info)
>> + ind_page = get_map_page(kvm, adapter, adapter_int->ind_addr);
>> + if (!ind_page)
>> return -1;
>> - map = page_address(info->page);
>> - bit = get_ind_bit(info->addr, adapter_int->ind_offset, adapter->swap);
>> - set_bit(bit, map);
>> - idx = srcu_read_lock(&kvm->srcu);
>> - mark_page_dirty(kvm, info->guest_addr >> PAGE_SHIFT);
>> - set_page_dirty_lock(info->page);
>> - info = get_map_info(adapter, adapter_int->summary_addr);
>> - if (!info) {
>> - srcu_read_unlock(&kvm->srcu, idx);
>> + summary_page = get_map_page(kvm, adapter, adapter_int->summary_addr);
>> + if (!summary_page) {
>> + put_page(ind_page);
>> return -1;
>> }
>> - map = page_address(info->page);
>> - bit = get_ind_bit(info->addr, adapter_int->summary_offset,
>> - adapter->swap);
>> +
>> + idx = srcu_read_lock(&kvm->srcu);
>> + map = page_address(ind_page);
>> + bit = get_ind_bit(adapter_int->ind_addr,
>> + adapter_int->ind_offset, adapter->swap);
>> + set_bit(bit, map);
>> + mark_page_dirty(kvm, adapter_int->ind_addr >> PAGE_SHIFT);
>> + set_page_dirty_lock(ind_page);
>> + map = page_address(summary_page);
>> + bit = get_ind_bit(adapter_int->summary_addr,
>> + adapter_int->summary_offset, adapter->swap);
>> summary_set = test_and_set_bit(bit, map);
>> - mark_page_dirty(kvm, info->guest_addr >> PAGE_SHIFT);
>> - set_page_dirty_lock(info->page);
>> + mark_page_dirty(kvm, adapter_int->summary_addr >> PAGE_SHIFT);
>> + set_page_dirty_lock(summary_page);
>> srcu_read_unlock(&kvm->srcu, idx);
>> +
>> + put_page(ind_page);
>> + put_page(summary_page);
>> return summary_set ? 0 : 1;
>> }
>>
>> @@ -2765,9 +2695,7 @@ static int set_adapter_int(struct kvm_kernel_irq_routing_entry *e,
>> adapter = get_io_adapter(kvm, e->adapter.adapter_id);
>> if (!adapter)
>> return -1;
>> - down_read(&adapter->maps_lock);
>> ret = adapter_indicators_set(kvm, adapter, &e->adapter);
>> - up_read(&adapter->maps_lock);
>> if ((ret > 0) && !adapter->masked) {
>> ret = kvm_s390_inject_airq(kvm, adapter);
>> if (ret == 0)
>> @@ -2818,23 +2746,27 @@ int kvm_set_routing_entry(struct kvm *kvm,
>> struct kvm_kernel_irq_routing_entry *e,
>> const struct kvm_irq_routing_entry *ue)
>> {
>> - int ret;
>> + u64 uaddr;
>>
>> switch (ue->type) {
>> + /* we store the userspace addresses instead of the guest addresses */
>> case KVM_IRQ_ROUTING_S390_ADAPTER:
>> e->set = set_adapter_int;
>> - e->adapter.summary_addr = ue->u.adapter.summary_addr;
>> - e->adapter.ind_addr = ue->u.adapter.ind_addr;
>> + uaddr = gmap_translate(kvm->arch.gmap, ue->u.adapter.summary_addr);
>> + if (uaddr == -EFAULT)
>> + return -EFAULT;
>> + e->adapter.summary_addr = uaddr;
>> + uaddr = gmap_translate(kvm->arch.gmap, ue->u.adapter.ind_addr);
>> + if (uaddr == -EFAULT)
>> + return -EFAULT;
>
> AFAIK, leaving e->adapter.summary_addr set is not an issue.
>
> Interesting, in kvm_s390_adapter_map(), we didn't synchronize again slot
> updates when doing the gmap_translate(), which looks wrong to me ...
>
> It seems to be the same thing here. I do wonder if it is safe to do a
> gmap_translate() here, looks like this can race with
> kvm_arch_commit_memory_region().
>
> I would have assumed we need e.g., the slots_lock while doing the
> gmap_translate() - or a srcu_read_lock(&vcpu->kvm->srcu) or similar ...
>
>
> Apart from that, looks good to me.
>
I think you missed this mail.
--
Thanks,
David / dhildenb
^ permalink raw reply
* [PATCH v2 1/8] bootconfig: Set CONFIG_BOOT_CONFIG=n by default
From: Masami Hiramatsu @ 2020-02-20 12:18 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Set CONFIG_BOOT_CONFIG=n by default. This also warns
user if CONFIG_BOOT_CONFIG=n but "bootconfig" is given
in the kernel command line.
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
V2: Use pr_warn() for warning message.
Remove unneeded "default n" line from Kconfig.
---
init/Kconfig | 1 -
init/main.c | 8 ++++++++
kernel/trace/Kconfig | 3 ++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index 452bc1835cd4..e76e9241552c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1227,7 +1227,6 @@ endif
config BOOT_CONFIG
bool "Boot config support"
depends on BLK_DEV_INITRD
- default y
help
Extra boot config allows system admin to pass a config file as
complemental extension of kernel cmdline when booting.
diff --git a/init/main.c b/init/main.c
index f95b014a5479..ae4e37681247 100644
--- a/init/main.c
+++ b/init/main.c
@@ -418,6 +418,14 @@ static void __init setup_boot_config(const char *cmdline)
}
#else
#define setup_boot_config(cmdline) do { } while (0)
+
+static int __init warn_bootconfig(char *str)
+{
+ pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOTCONFIG is not set.\n");
+ return 0;
+}
+early_param("bootconfig", warn_bootconfig);
+
#endif
/* Change NUL term back to "=", to make "param" the whole string. */
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 91e885194dbc..795c3e02d3f1 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -143,7 +143,8 @@ if FTRACE
config BOOTTIME_TRACING
bool "Boot-time Tracing support"
- depends on BOOT_CONFIG && TRACING
+ depends on TRACING
+ select BOOT_CONFIG
default y
help
Enable developer to setup ftrace subsystem via supplemental
^ permalink raw reply related
* [PATCH v2 2/8] bootconfig: Add bootconfig magic word for indicating bootconfig explicitly
From: Masami Hiramatsu @ 2020-02-20 12:18 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Add bootconfig magic word to the end of bootconfig on initrd
image for indicating explicitly the bootconfig is there.
Also tools/bootconfig treats wrong size or wrong checksum or
parse error as an error, because if there is a bootconfig magic
word, there must be a bootconfig.
The bootconfig magic word is "#BOOTCONFIG\n", 12 bytes word.
Thus the block image of the initrd file with bootconfig is
as follows.
[Initrd][bootconfig][size][csum][#BOOTCONFIG\n]
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
V2: Update Kconfig comment.
---
Documentation/admin-guide/bootconfig.rst | 10 +++++--
include/linux/bootconfig.h | 3 ++
init/Kconfig | 2 +
init/main.c | 6 +++-
tools/bootconfig/main.c | 43 ++++++++++++++++++++++--------
tools/bootconfig/test-bootconfig.sh | 2 +
6 files changed, 49 insertions(+), 17 deletions(-)
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index b342a6796392..5e7609936507 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -102,9 +102,13 @@ Boot Kernel With a Boot Config
==============================
Since the boot configuration file is loaded with initrd, it will be added
-to the end of the initrd (initramfs) image file. The Linux kernel decodes
-the last part of the initrd image in memory to get the boot configuration
-data.
+to the end of the initrd (initramfs) image file with size, checksum and
+12-byte magic word as below.
+
+[initrd][bootconfig][size(u32)][checksum(u32)][#BOOTCONFIG\n]
+
+The Linux kernel decodes the last part of the initrd image in memory to
+get the boot configuration data.
Because of this "piggyback" method, there is no need to change or
update the boot loader and the kernel image itself.
diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h
index 7e18c939663e..d11e183fcb54 100644
--- a/include/linux/bootconfig.h
+++ b/include/linux/bootconfig.h
@@ -10,6 +10,9 @@
#include <linux/kernel.h>
#include <linux/types.h>
+#define BOOTCONFIG_MAGIC "#BOOTCONFIG\n"
+#define BOOTCONFIG_MAGIC_LEN 12
+
/* XBC tree node */
struct xbc_node {
u16 next;
diff --git a/init/Kconfig b/init/Kconfig
index e76e9241552c..6ffaf4940f3e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1231,7 +1231,7 @@ config BOOT_CONFIG
Extra boot config allows system admin to pass a config file as
complemental extension of kernel cmdline when booting.
The boot config file must be attached at the end of initramfs
- with checksum and size.
+ with checksum, size and magic word.
See <file:Documentation/admin-guide/bootconfig.rst> for details.
If unsure, say Y.
diff --git a/init/main.c b/init/main.c
index ae4e37681247..fe3ed874c748 100644
--- a/init/main.c
+++ b/init/main.c
@@ -374,7 +374,11 @@ static void __init setup_boot_config(const char *cmdline)
if (!initrd_end)
goto not_found;
- hdr = (u32 *)(initrd_end - 8);
+ data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN;
+ if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
+ goto not_found;
+
+ hdr = (u32 *)(data - 8);
size = hdr[0];
csum = hdr[1];
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index e18eeb070562..742271f019a9 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -131,15 +131,26 @@ int load_xbc_from_initrd(int fd, char **buf)
struct stat stat;
int ret;
u32 size = 0, csum = 0, rcsum;
+ char magic[BOOTCONFIG_MAGIC_LEN];
ret = fstat(fd, &stat);
if (ret < 0)
return -errno;
- if (stat.st_size < 8)
+ if (stat.st_size < 8 + BOOTCONFIG_MAGIC_LEN)
return 0;
- if (lseek(fd, -8, SEEK_END) < 0) {
+ if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0) {
+ pr_err("Failed to lseek: %d\n", -errno);
+ return -errno;
+ }
+ if (read(fd, magic, BOOTCONFIG_MAGIC_LEN) < 0)
+ return -errno;
+ /* Check the bootconfig magic bytes */
+ if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
+ return 0;
+
+ if (lseek(fd, -(8 + BOOTCONFIG_MAGIC_LEN), SEEK_END) < 0) {
pr_err("Failed to lseek: %d\n", -errno);
return -errno;
}
@@ -150,11 +161,14 @@ int load_xbc_from_initrd(int fd, char **buf)
if (read(fd, &csum, sizeof(u32)) < 0)
return -errno;
- /* Wrong size, maybe no boot config here */
- if (stat.st_size < size + 8)
- return 0;
+ /* Wrong size error */
+ if (stat.st_size < size + 8 + BOOTCONFIG_MAGIC_LEN) {
+ pr_err("bootconfig size is too big\n");
+ return -E2BIG;
+ }
- if (lseek(fd, stat.st_size - 8 - size, SEEK_SET) < 0) {
+ if (lseek(fd, stat.st_size - (size + 8 + BOOTCONFIG_MAGIC_LEN),
+ SEEK_SET) < 0) {
pr_err("Failed to lseek: %d\n", -errno);
return -errno;
}
@@ -163,17 +177,17 @@ int load_xbc_from_initrd(int fd, char **buf)
if (ret < 0)
return ret;
- /* Wrong Checksum, maybe no boot config here */
+ /* Wrong Checksum */
rcsum = checksum((unsigned char *)*buf, size);
if (csum != rcsum) {
pr_err("checksum error: %d != %d\n", csum, rcsum);
- return 0;
+ return -EINVAL;
}
ret = xbc_init(*buf);
- /* Wrong data, maybe no boot config here */
+ /* Wrong data */
if (ret < 0)
- return 0;
+ return ret;
return size;
}
@@ -226,7 +240,8 @@ int delete_xbc(const char *path)
} else if (size > 0) {
ret = fstat(fd, &stat);
if (!ret)
- ret = ftruncate(fd, stat.st_size - size - 8);
+ ret = ftruncate(fd, stat.st_size
+ - size - 8 - BOOTCONFIG_MAGIC_LEN);
if (ret)
ret = -errno;
} /* Ignore if there is no boot config in initrd */
@@ -295,6 +310,12 @@ int apply_xbc(const char *path, const char *xbc_path)
pr_err("Failed to apply a boot config: %d\n", ret);
return ret;
}
+ /* Write a magic word of the bootconfig */
+ ret = write(fd, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
+ if (ret < 0) {
+ pr_err("Failed to apply a boot config magic: %d\n", ret);
+ return ret;
+ }
close(fd);
free(data);
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index 1de06de328e2..adafb7c50940 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -49,7 +49,7 @@ xpass $BOOTCONF -a $TEMPCONF $INITRD
new_size=$(stat -c %s $INITRD)
echo "File size check"
-xpass test $new_size -eq $(expr $bconf_size + $initrd_size + 9)
+xpass test $new_size -eq $(expr $bconf_size + $initrd_size + 9 + 12)
echo "Apply command repeat test"
xpass $BOOTCONF -a $TEMPCONF $INITRD
^ permalink raw reply related
* [PATCH v2 3/8] tools/bootconfig: Remove unneeded error message silencer
From: Masami Hiramatsu @ 2020-02-20 12:18 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Remove error message silent knob, we don't need it anymore
because we can check if there is a bootconfig by checking
the magic word.
If there is a magic word, but failed to load a bootconfig
from initrd, there is a real problem.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/bootconfig/include/linux/printk.h | 5 +----
tools/bootconfig/main.c | 8 --------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/tools/bootconfig/include/linux/printk.h b/tools/bootconfig/include/linux/printk.h
index e978a63d3222..036e667596eb 100644
--- a/tools/bootconfig/include/linux/printk.h
+++ b/tools/bootconfig/include/linux/printk.h
@@ -4,10 +4,7 @@
#include <stdio.h>
-/* controllable printf */
-extern int pr_output;
-#define printk(fmt, ...) \
- (pr_output ? printf(fmt, ##__VA_ARGS__) : 0)
+#define printk(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define pr_err printk
#define pr_warn printk
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 742271f019a9..a9b97814d1a9 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -14,8 +14,6 @@
#include <linux/kernel.h>
#include <linux/bootconfig.h>
-int pr_output = 1;
-
static int xbc_show_array(struct xbc_node *node)
{
const char *val;
@@ -227,13 +225,7 @@ int delete_xbc(const char *path)
return -errno;
}
- /*
- * Suppress error messages in xbc_init() because it can be just a
- * data which concidentally matches the size and checksum footer.
- */
- pr_output = 0;
size = load_xbc_from_initrd(fd, &buf);
- pr_output = 1;
if (size < 0) {
ret = size;
pr_err("Failed to load a boot config from initrd: %d\n", ret);
^ permalink raw reply related
* [PATCH v2 4/8] bootconfig: Remove unneeded checksum
From: Masami Hiramatsu @ 2020-02-20 12:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Remove checksum of bootconfig because we already use a magic
word to identify bootconfig. This checksum was used for
checking whether there is a bootconfig at the end of initrd
or not. Since we have a bootconfig magic word to identify
the bootconfig data, we do not this checksum anymore.
Thus the block image of the initrd file with bootconfig is
as follows.
[initrd][bootconfig][size(u32)][#BOOTCONFIG\n]
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
V2: Update Kconfig comment.
---
Documentation/admin-guide/bootconfig.rst | 6 ++--
init/Kconfig | 2 +
init/main.c | 20 +-------------
tools/bootconfig/main.c | 42 ++++++------------------------
tools/bootconfig/test-bootconfig.sh | 2 +
5 files changed, 16 insertions(+), 56 deletions(-)
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index 5e7609936507..48675052c963 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -102,10 +102,10 @@ Boot Kernel With a Boot Config
==============================
Since the boot configuration file is loaded with initrd, it will be added
-to the end of the initrd (initramfs) image file with size, checksum and
-12-byte magic word as below.
+to the end of the initrd (initramfs) image file with 4-byte size and 12-byte
+magic word as below.
-[initrd][bootconfig][size(u32)][checksum(u32)][#BOOTCONFIG\n]
+[initrd][bootconfig][size][#BOOTCONFIG\n]
The Linux kernel decodes the last part of the initrd image in memory to
get the boot configuration data.
diff --git a/init/Kconfig b/init/Kconfig
index 6ffaf4940f3e..631ef2864608 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1231,7 +1231,7 @@ config BOOT_CONFIG
Extra boot config allows system admin to pass a config file as
complemental extension of kernel cmdline when booting.
The boot config file must be attached at the end of initramfs
- with checksum, size and magic word.
+ with size and magic word.
See <file:Documentation/admin-guide/bootconfig.rst> for details.
If unsure, say Y.
diff --git a/init/main.c b/init/main.c
index fe3ed874c748..821c582af49b 100644
--- a/init/main.c
+++ b/init/main.c
@@ -335,16 +335,6 @@ static char * __init xbc_make_cmdline(const char *key)
return new_cmdline;
}
-u32 boot_config_checksum(unsigned char *p, u32 size)
-{
- u32 ret = 0;
-
- while (size--)
- ret += *p++;
-
- return ret;
-}
-
static int __init bootconfig_params(char *param, char *val,
const char *unused, void *arg)
{
@@ -359,7 +349,7 @@ static int __init bootconfig_params(char *param, char *val,
static void __init setup_boot_config(const char *cmdline)
{
static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
- u32 size, csum;
+ u32 size;
char *data, *copy;
u32 *hdr;
int ret;
@@ -378,9 +368,8 @@ static void __init setup_boot_config(const char *cmdline)
if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN))
goto not_found;
- hdr = (u32 *)(data - 8);
+ hdr = (u32 *)(data - sizeof(u32));
size = hdr[0];
- csum = hdr[1];
if (size >= XBC_DATA_MAX) {
pr_err("bootconfig size %d greater than max size %d\n",
@@ -392,11 +381,6 @@ static void __init setup_boot_config(const char *cmdline)
if ((unsigned long)data < initrd_start)
goto not_found;
- if (boot_config_checksum((unsigned char *)data, size) != csum) {
- pr_err("bootconfig checksum failed\n");
- return;
- }
-
copy = memblock_alloc(size + 1, SMP_CACHE_BYTES);
if (!copy) {
pr_err("Failed to allocate memory for bootconfig\n");
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index a9b97814d1a9..01acb86c6273 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -75,17 +75,6 @@ static void xbc_show_compact_tree(void)
}
}
-/* Simple real checksum */
-int checksum(unsigned char *buf, int len)
-{
- int i, sum = 0;
-
- for (i = 0; i < len; i++)
- sum += buf[i];
-
- return sum;
-}
-
#define PAGE_SIZE 4096
int load_xbc_fd(int fd, char **buf, int size)
@@ -128,14 +117,14 @@ int load_xbc_from_initrd(int fd, char **buf)
{
struct stat stat;
int ret;
- u32 size = 0, csum = 0, rcsum;
+ u32 size = 0;
char magic[BOOTCONFIG_MAGIC_LEN];
ret = fstat(fd, &stat);
if (ret < 0)
return -errno;
- if (stat.st_size < 8 + BOOTCONFIG_MAGIC_LEN)
+ if (stat.st_size < 4 + BOOTCONFIG_MAGIC_LEN)
return 0;
if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0) {
@@ -148,7 +137,7 @@ int load_xbc_from_initrd(int fd, char **buf)
if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
return 0;
- if (lseek(fd, -(8 + BOOTCONFIG_MAGIC_LEN), SEEK_END) < 0) {
+ if (lseek(fd, -(4 + BOOTCONFIG_MAGIC_LEN), SEEK_END) < 0) {
pr_err("Failed to lseek: %d\n", -errno);
return -errno;
}
@@ -156,16 +145,13 @@ int load_xbc_from_initrd(int fd, char **buf)
if (read(fd, &size, sizeof(u32)) < 0)
return -errno;
- if (read(fd, &csum, sizeof(u32)) < 0)
- return -errno;
-
/* Wrong size error */
- if (stat.st_size < size + 8 + BOOTCONFIG_MAGIC_LEN) {
+ if (stat.st_size < size + 4 + BOOTCONFIG_MAGIC_LEN) {
pr_err("bootconfig size is too big\n");
return -E2BIG;
}
- if (lseek(fd, stat.st_size - (size + 8 + BOOTCONFIG_MAGIC_LEN),
+ if (lseek(fd, stat.st_size - (size + 4 + BOOTCONFIG_MAGIC_LEN),
SEEK_SET) < 0) {
pr_err("Failed to lseek: %d\n", -errno);
return -errno;
@@ -175,13 +161,6 @@ int load_xbc_from_initrd(int fd, char **buf)
if (ret < 0)
return ret;
- /* Wrong Checksum */
- rcsum = checksum((unsigned char *)*buf, size);
- if (csum != rcsum) {
- pr_err("checksum error: %d != %d\n", csum, rcsum);
- return -EINVAL;
- }
-
ret = xbc_init(*buf);
/* Wrong data */
if (ret < 0)
@@ -233,7 +212,7 @@ int delete_xbc(const char *path)
ret = fstat(fd, &stat);
if (!ret)
ret = ftruncate(fd, stat.st_size
- - size - 8 - BOOTCONFIG_MAGIC_LEN);
+ - size - 4 - BOOTCONFIG_MAGIC_LEN);
if (ret)
ret = -errno;
} /* Ignore if there is no boot config in initrd */
@@ -246,7 +225,7 @@ int delete_xbc(const char *path)
int apply_xbc(const char *path, const char *xbc_path)
{
- u32 size, csum;
+ u32 size;
char *buf, *data;
int ret, fd;
@@ -256,15 +235,13 @@ int apply_xbc(const char *path, const char *xbc_path)
return ret;
}
size = strlen(buf) + 1;
- csum = checksum((unsigned char *)buf, size);
/* Prepare xbc_path data */
- data = malloc(size + 8);
+ data = malloc(size + 4);
if (!data)
return -ENOMEM;
strcpy(data, buf);
*(u32 *)(data + size) = size;
- *(u32 *)(data + size + 4) = csum;
/* Check the data format */
ret = xbc_init(buf);
@@ -277,7 +254,6 @@ int apply_xbc(const char *path, const char *xbc_path)
printf("Apply %s to %s\n", xbc_path, path);
printf("\tNumber of nodes: %d\n", ret);
printf("\tSize: %u bytes\n", (unsigned int)size);
- printf("\tChecksum: %d\n", (unsigned int)csum);
/* TODO: Check the options by schema */
xbc_destroy_all();
@@ -297,7 +273,7 @@ int apply_xbc(const char *path, const char *xbc_path)
return fd;
}
/* TODO: Ensure the @path is initramfs/initrd image */
- ret = write(fd, data, size + 8);
+ ret = write(fd, data, size + 4);
if (ret < 0) {
pr_err("Failed to apply a boot config: %d\n", ret);
return ret;
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index adafb7c50940..c5965eff62c5 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -49,7 +49,7 @@ xpass $BOOTCONF -a $TEMPCONF $INITRD
new_size=$(stat -c %s $INITRD)
echo "File size check"
-xpass test $new_size -eq $(expr $bconf_size + $initrd_size + 9 + 12)
+xpass test $new_size -eq $(expr $bconf_size + $initrd_size + 5 + 12)
echo "Apply command repeat test"
xpass $BOOTCONF -a $TEMPCONF $INITRD
^ permalink raw reply related
* [PATCH v2 5/8] bootconfig: Reject subkey and value on same parent key
From: Masami Hiramatsu @ 2020-02-20 12:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Reject if a value node is mixed with subkey node on same
parent key node.
A value node can not co-exist with subkey node under some key
node, e.g.
key = value
key.subkey = another-value
This is not be allowed because bootconfig API is not designed
to handle such case.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
Documentation/admin-guide/bootconfig.rst | 7 +++++++
lib/bootconfig.c | 16 ++++++++++++----
tools/bootconfig/samples/bad-mixed-kv1.bconf | 3 +++
tools/bootconfig/samples/bad-mixed-kv2.bconf | 3 +++
4 files changed, 25 insertions(+), 4 deletions(-)
create mode 100644 tools/bootconfig/samples/bad-mixed-kv1.bconf
create mode 100644 tools/bootconfig/samples/bad-mixed-kv2.bconf
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index 48675052c963..4a106584eb21 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -62,6 +62,13 @@ Or more shorter, written as following::
In both styles, same key words are automatically merged when parsing it
at boot time. So you can append similar trees or key-values.
+Note that a sub-key and a value can not co-exist under a parent key.
+For example, following config is NOT allowed.::
+
+ foo = value1
+ foo.bar = value2 # !ERROR! subkey "bar" and value "value1" can NOT co-exist
+
+
Comments
--------
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 3ea601a2eba5..54ac623ca781 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -533,7 +533,7 @@ struct xbc_node *find_match_node(struct xbc_node *node, char *k)
static int __init __xbc_add_key(char *k)
{
- struct xbc_node *node;
+ struct xbc_node *node, *child;
if (!xbc_valid_keyword(k))
return xbc_parse_error("Invalid keyword", k);
@@ -543,8 +543,12 @@ static int __init __xbc_add_key(char *k)
if (!last_parent) /* the first level */
node = find_match_node(xbc_nodes, k);
- else
- node = find_match_node(xbc_node_get_child(last_parent), k);
+ else {
+ child = xbc_node_get_child(last_parent);
+ if (child && xbc_node_is_value(child))
+ return xbc_parse_error("Subkey is mixed with value", k);
+ node = find_match_node(child, k);
+ }
if (node)
last_parent = node;
@@ -577,7 +581,7 @@ static int __init __xbc_parse_keys(char *k)
static int __init xbc_parse_kv(char **k, char *v)
{
struct xbc_node *prev_parent = last_parent;
- struct xbc_node *node;
+ struct xbc_node *node, *child;
char *next;
int c, ret;
@@ -585,6 +589,10 @@ static int __init xbc_parse_kv(char **k, char *v)
if (ret)
return ret;
+ child = xbc_node_get_child(last_parent);
+ if (child && xbc_node_is_key(child))
+ return xbc_parse_error("Value is mixed with subkey", v);
+
c = __xbc_parse_value(&v, &next);
if (c < 0)
return c;
diff --git a/tools/bootconfig/samples/bad-mixed-kv1.bconf b/tools/bootconfig/samples/bad-mixed-kv1.bconf
new file mode 100644
index 000000000000..1761547dd05c
--- /dev/null
+++ b/tools/bootconfig/samples/bad-mixed-kv1.bconf
@@ -0,0 +1,3 @@
+# value -> subkey pattern
+key = value
+key.subkey = another-value
diff --git a/tools/bootconfig/samples/bad-mixed-kv2.bconf b/tools/bootconfig/samples/bad-mixed-kv2.bconf
new file mode 100644
index 000000000000..6b32e0c3878c
--- /dev/null
+++ b/tools/bootconfig/samples/bad-mixed-kv2.bconf
@@ -0,0 +1,3 @@
+# subkey -> value pattern
+key.subkey = value
+key = another-value
^ permalink raw reply related
* [PATCH v2 6/8] bootconfig: Overwrite value on same key by default
From: Masami Hiramatsu @ 2020-02-20 12:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Currently, bootconfig does not overwrite existing value
on same key, but add new value to the tail of an array.
But this looks a bit confusing because similar syntax
configuration always overwrite the value by default.
This changes the behavior to overwrite value on same key.
For example, if there are 2 entries
key = value
...
key = value2
Then, the key is updated as below.
key = value2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
Documentation/admin-guide/bootconfig.rst | 12 ++++++++++++
lib/bootconfig.c | 18 ++++++++++++++----
tools/bootconfig/test-bootconfig.sh | 16 ++++++++++++++--
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index 4a106584eb21..0c18e3f540e6 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -62,6 +62,18 @@ Or more shorter, written as following::
In both styles, same key words are automatically merged when parsing it
at boot time. So you can append similar trees or key-values.
+Same-key Values
+---------------
+
+If two or more values or arraies share a same-key, the latter one remains.
+For example,::
+
+ foo = bar, baz
+ foo = qux
+
+In this case ``bar`` and ``baz`` is overwritten by ``qux``, and ``foo = qux``
+remains.
+
Note that a sub-key and a value can not co-exist under a parent key.
For example, following config is NOT allowed.::
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 54ac623ca781..9a094162ea3e 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -578,10 +578,18 @@ static int __init __xbc_parse_keys(char *k)
return __xbc_add_key(k);
}
+static void xbc_node_overwrite(struct xbc_node *node, char *v)
+{
+ unsigned long offset = v - xbc_data;
+
+ node->data = (u16)offset | XBC_VALUE;
+ node->next = 0;
+}
+
static int __init xbc_parse_kv(char **k, char *v)
{
struct xbc_node *prev_parent = last_parent;
- struct xbc_node *node, *child;
+ struct xbc_node *child;
char *next;
int c, ret;
@@ -597,9 +605,11 @@ static int __init xbc_parse_kv(char **k, char *v)
if (c < 0)
return c;
- node = xbc_add_sibling(v, XBC_VALUE);
- if (!node)
- return -ENOMEM;
+ if (!child) {
+ if (!xbc_add_sibling(v, XBC_VALUE))
+ return -ENOMEM;
+ } else
+ xbc_node_overwrite(child, v);
if (c == ',') { /* Array */
c = xbc_parse_array(&next);
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index c5965eff62c5..f6948790c693 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -9,7 +9,7 @@ TEMPCONF=`mktemp temp-XXXX.bconf`
NG=0
cleanup() {
- rm -f $INITRD $TEMPCONF
+ rm -f $INITRD $TEMPCONF $OUTFILE
exit $NG
}
@@ -71,7 +71,6 @@ printf " \0\0\0 \0\0\0" >> $INITRD
$BOOTCONF -a $TEMPCONF $INITRD > $OUTFILE 2>&1
xfail grep -i "failed" $OUTFILE
xfail grep -i "error" $OUTFILE
-rm $OUTFILE
echo "Max node number check"
@@ -96,6 +95,19 @@ truncate -s 32764 $TEMPCONF
echo "\"" >> $TEMPCONF # add 2 bytes + terminal ('\"\n\0')
xpass $BOOTCONF -a $TEMPCONF $INITRD
+echo "Overwrite same-key values"
+cat > $TEMPCONF << EOF
+key = bar, baz
+key = qux
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xfail grep -q "bar" $OUTFILE
+xfail grep -q "baz" $OUTFILE
+xpass grep -q "qux" $OUTFILE
+
echo "=== expected failure cases ==="
for i in samples/bad-* ; do
xfail $BOOTCONF -a $i $INITRD
^ permalink raw reply related
* [PATCH v2 7/8] bootconfig: Add append value operator support
From: Masami Hiramatsu @ 2020-02-20 12:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Add append value operator "+=" support to bootconfig syntax.
With this operator, user can add new value to the key as
an entry of array instead of overwriting.
For example,
foo = bar
...
foo += baz
Then the key "foo" has "bar" and "baz" values as an array.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
Documentation/admin-guide/bootconfig.rst | 8 ++++++++
lib/bootconfig.c | 14 ++++++++++----
tools/bootconfig/test-bootconfig.sh | 13 +++++++++++++
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/admin-guide/bootconfig.rst
index 0c18e3f540e6..abe2432b8eec 100644
--- a/Documentation/admin-guide/bootconfig.rst
+++ b/Documentation/admin-guide/bootconfig.rst
@@ -74,6 +74,14 @@ For example,::
In this case ``bar`` and ``baz`` is overwritten by ``qux``, and ``foo = qux``
remains.
+If you want to append the value to existing key as an array member,
+you can use ``+=`` operator. For example::
+
+ foo = bar, baz
+ foo += qux
+
+In this case, the key ``foo`` has ``bar``, ``baz`` and ``qux``.
+
Note that a sub-key and a value can not co-exist under a parent key.
For example, following config is NOT allowed.::
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 9a094162ea3e..4afc768489cd 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -586,7 +586,7 @@ static void xbc_node_overwrite(struct xbc_node *node, char *v)
node->next = 0;
}
-static int __init xbc_parse_kv(char **k, char *v)
+static int __init xbc_parse_kv(char **k, char *v, int op)
{
struct xbc_node *prev_parent = last_parent;
struct xbc_node *child;
@@ -605,7 +605,7 @@ static int __init xbc_parse_kv(char **k, char *v)
if (c < 0)
return c;
- if (!child) {
+ if (op == '+' || !child) {
if (!xbc_add_sibling(v, XBC_VALUE))
return -ENOMEM;
} else
@@ -781,7 +781,7 @@ int __init xbc_init(char *buf)
p = buf;
do {
- q = strpbrk(p, "{}=;\n#");
+ q = strpbrk(p, "{}=+;\n#");
if (!q) {
p = skip_spaces(p);
if (*p != '\0')
@@ -792,8 +792,14 @@ int __init xbc_init(char *buf)
c = *q;
*q++ = '\0';
switch (c) {
+ case '+':
+ if (*q++ != '=') {
+ ret = xbc_parse_error("Wrong + operator", q - 2);
+ break;
+ }
+ /* Fall through */
case '=':
- ret = xbc_parse_kv(&p, q);
+ ret = xbc_parse_kv(&p, q, c);
break;
case '{':
ret = xbc_open_brace(&p, q);
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index f6948790c693..04f65548ca1e 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -108,6 +108,19 @@ xfail grep -q "bar" $OUTFILE
xfail grep -q "baz" $OUTFILE
xpass grep -q "qux" $OUTFILE
+echo "Adding same-key values"
+cat > $TEMPCONF << EOF
+key = bar, baz
+key += qux
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xpass grep -q "bar" $OUTFILE
+xpass grep -q "baz" $OUTFILE
+xpass grep -q "qux" $OUTFILE
+
echo "=== expected failure cases ==="
for i in samples/bad-* ; do
xfail $BOOTCONF -a $i $INITRD
^ permalink raw reply related
* [PATCH v2 8/8] bootconfig: Print array as multiple commands for legacy command line
From: Masami Hiramatsu @ 2020-02-20 12:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: Geert Uytterhoeven, Borislav Petkov, LKML, Ingo Molnar,
Andrew Morton, Masami Hiramatsu, Peter Zijlstra
In-Reply-To: <158220110257.26565.4812934676257459744.stgit@devnote2>
Print arraied values as multiple same options for legacy
kernel command line. With this rule, if the "kernel.*" and
"init.*" array entries in bootconfig are printed out as
multiple same options, e.g.
kernel {
console = "ttyS0,115200"
console += "tty0"
}
will be correctly converted to
console="ttyS0,115200" console="tty0"
in the kernel command line.
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
init/main.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/init/main.c b/init/main.c
index 821c582af49b..19a5577e0bb0 100644
--- a/init/main.c
+++ b/init/main.c
@@ -268,7 +268,6 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size,
{
struct xbc_node *knode, *vnode;
char *end = buf + size;
- char c = '\"';
const char *val;
int ret;
@@ -279,25 +278,20 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size,
return ret;
vnode = xbc_node_get_child(knode);
- ret = snprintf(buf, rest(buf, end), "%s%c", xbc_namebuf,
- vnode ? '=' : ' ');
- if (ret < 0)
- return ret;
- buf += ret;
- if (!vnode)
+ if (!vnode) {
+ ret = snprintf(buf, rest(buf, end), "%s ", xbc_namebuf);
+ if (ret < 0)
+ return ret;
+ buf += ret;
continue;
-
- c = '\"';
+ }
xbc_array_for_each_value(vnode, val) {
- ret = snprintf(buf, rest(buf, end), "%c%s", c, val);
+ ret = snprintf(buf, rest(buf, end), "%s=\"%s\" ",
+ xbc_namebuf, val);
if (ret < 0)
return ret;
buf += ret;
- c = ',';
}
- if (rest(buf, end) > 2)
- strcpy(buf, "\" ");
- buf += 2;
}
return buf - (end - size);
^ permalink raw reply related
* Re: [PATCH 4/4] crypto: hisilicon/sec2 - Add pbuffer mode for SEC driver
From: John Garry @ 2020-02-20 12:20 UTC (permalink / raw)
To: Xu Zaibo, herbert, davem
Cc: qianweili, tanghui20, forest.zhouchang, linuxarm, zhangwei375,
shenyang39, yekai13, linux-crypto
In-Reply-To: <bac7ec3e-43e6-9061-fbbe-03f4404f1c50@huawei.com>
On 20/02/2020 12:16, Xu Zaibo wrote:
>
> On 2020/2/20 19:07, John Garry wrote:
>> On 20/02/2020 10:10, Xu Zaibo wrote:
>>> Hi,
>>>
>>>
>>> On 2020/2/20 17:50, John Garry wrote:
>>>> On 20/02/2020 09:04, Zaibo Xu wrote:
>>>>> From: liulongfang <liulongfang@huawei.com>
>>>>>
>>>>> In the scenario of SMMU translation, the SEC performance of short
>>>>> messages
>>>>> (<512Bytes) cannot meet our expectations. To avoid this, we reserve
>>>>> the
>>>>> plat buffer (PBUF) memory for small packets when creating TFM.
>>>>>
>>>>
>>>> I haven't gone through the code here, but why not use this method
>>>> also for non-translated? What are the pros and cons?
>>> Because non-translated has no performance or throughput problems.
>>>
>>
>> OK, so no problem, but I was asking could it be improved, and, if so,
>> what would be the drawbacks?
>>
>> As for the change to check if the IOMMU is translating, it seems exact
>> same as that for the hi1616 driver...
>>
> Currently, I find the only drawback is needing more memory :),
OK, so that is a drawback.
> what's
> your idea?
I am just asking if we get any performance gain for using this same
method for non-IOMMU case, and does the gain (if any) in performance
outweigh the additional memory usage?
> Yes, the same as SEC V1.
So it could be factored out :)
thanks,
john
^ permalink raw reply
* [PATCH] usbvision: deprecate driver
From: Hans Verkuil @ 2020-02-20 12:20 UTC (permalink / raw)
To: Linux Media Mailing List
The driver is deprecated and scheduled for removal by the end
of 2020. The reason is that this driver is for old and obsolete
hardware, and it produces a continuous stream of syzbot errors due
to poor code.
In order to prevent removal the following actions would have to
be taken:
- clean up the code
- convert to the vb2 framework
- fix the disconnect and free-on-last-user handling (i.e., add
a release callback for struct v4l2_device and rework the code
to use that correctly).
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
MAINTAINERS | 2 +-
drivers/media/usb/Kconfig | 1 -
drivers/media/usb/Makefile | 1 -
drivers/staging/media/Kconfig | 4 ++++
drivers/staging/media/Makefile | 1 +
.../{media/usb => staging/media}/usbvision/Kconfig | 7 ++++++-
.../{media/usb => staging/media}/usbvision/Makefile | 0
drivers/staging/media/usbvision/TODO | 11 +++++++++++
.../usb => staging/media}/usbvision/usbvision-cards.c | 0
.../usb => staging/media}/usbvision/usbvision-cards.h | 0
.../usb => staging/media}/usbvision/usbvision-core.c | 0
.../usb => staging/media}/usbvision/usbvision-i2c.c | 0
.../usb => staging/media}/usbvision/usbvision-video.c | 0
.../usb => staging/media}/usbvision/usbvision.h | 0
14 files changed, 23 insertions(+), 4 deletions(-)
rename drivers/{media/usb => staging/media}/usbvision/Kconfig (57%)
rename drivers/{media/usb => staging/media}/usbvision/Makefile (100%)
create mode 100644 drivers/staging/media/usbvision/TODO
rename drivers/{media/usb => staging/media}/usbvision/usbvision-cards.c (100%)
rename drivers/{media/usb => staging/media}/usbvision/usbvision-cards.h (100%)
rename drivers/{media/usb => staging/media}/usbvision/usbvision-core.c (100%)
rename drivers/{media/usb => staging/media}/usbvision/usbvision-i2c.c (100%)
rename drivers/{media/usb => staging/media}/usbvision/usbvision-video.c (100%)
rename drivers/{media/usb => staging/media}/usbvision/usbvision.h (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 38fe2f3f7b6f..5a976815a0a4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17444,7 +17444,7 @@ L: linux-media@vger.kernel.org
T: git git://linuxtv.org/media_tree.git
W: https://linuxtv.org
S: Odd Fixes
-F: drivers/media/usb/usbvision/
+F: drivers/staging/media/usbvision/
USB WEBCAM GADGET
M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
index 03c2944f6273..e678d3d11467 100644
--- a/drivers/media/usb/Kconfig
+++ b/drivers/media/usb/Kconfig
@@ -25,7 +25,6 @@ if MEDIA_ANALOG_TV_SUPPORT
comment "Analog TV USB devices"
source "drivers/media/usb/pvrusb2/Kconfig"
source "drivers/media/usb/hdpvr/Kconfig"
-source "drivers/media/usb/usbvision/Kconfig"
source "drivers/media/usb/stk1160/Kconfig"
source "drivers/media/usb/go7007/Kconfig"
endif
diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
index 21e46b10caa5..169aa07c97bd 100644
--- a/drivers/media/usb/Makefile
+++ b/drivers/media/usb/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
obj-$(CONFIG_VIDEO_AU0828) += au0828/
obj-$(CONFIG_VIDEO_HDPVR) += hdpvr/
obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/
-obj-$(CONFIG_VIDEO_USBVISION) += usbvision/
obj-$(CONFIG_VIDEO_STK1160) += stk1160/
obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
obj-$(CONFIG_VIDEO_TM6000) += tm6000/
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index c394abffea86..e59a846bc909 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -42,4 +42,8 @@ source "drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig"
source "drivers/staging/media/rkisp1/Kconfig"
+if MEDIA_ANALOG_TV_SUPPORT
+source "drivers/staging/media/usbvision/Kconfig"
+endif
+
endif
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index ea9fce8014bb..23c682461b62 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/
obj-$(CONFIG_SOC_CAMERA) += soc_camera/
obj-$(CONFIG_PHY_ROCKCHIP_DPHY_RX0) += phy-rockchip-dphy-rx0/
obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rkisp1/
+obj-$(CONFIG_VIDEO_USBVISION) += usbvision/
diff --git a/drivers/media/usb/usbvision/Kconfig b/drivers/staging/media/usbvision/Kconfig
similarity index 57%
rename from drivers/media/usb/usbvision/Kconfig
rename to drivers/staging/media/usbvision/Kconfig
index e1039fdfb0ea..7903f558494e 100644
--- a/drivers/media/usb/usbvision/Kconfig
+++ b/drivers/staging/media/usbvision/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
config VIDEO_USBVISION
- tristate "USB video devices based on Nogatech NT1003/1004/1005"
+ tristate "USB video devices based on Nogatech NT1003/1004/1005 (Deprecated)"
depends on I2C && VIDEO_V4L2
select VIDEO_TUNER
select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
@@ -9,5 +9,10 @@ config VIDEO_USBVISION
NT1003/1004/1005 USB Bridges. This driver enables using those
devices.
+ This driver is deprecated and scheduled for removal by the
+ end of 2020. See the TODO file in drivers/staging/media/usbvision
+ for a list of actions that have to be done in order to prevent
+ removal of this driver.
+
To compile this driver as a module, choose M here: the
module will be called usbvision.
diff --git a/drivers/media/usb/usbvision/Makefile b/drivers/staging/media/usbvision/Makefile
similarity index 100%
rename from drivers/media/usb/usbvision/Makefile
rename to drivers/staging/media/usbvision/Makefile
diff --git a/drivers/staging/media/usbvision/TODO b/drivers/staging/media/usbvision/TODO
new file mode 100644
index 000000000000..e9fb4d125581
--- /dev/null
+++ b/drivers/staging/media/usbvision/TODO
@@ -0,0 +1,11 @@
+The driver is deprecated and scheduled for removal by the end
+of 2020.
+
+In order to prevent removal the following actions would have to
+be taken:
+
+- clean up the code
+- convert to the vb2 framework
+- fix the disconnect and free-on-last-user handling (i.e., add
+ a release callback for struct v4l2_device and rework the code
+ to use that correctly).
diff --git a/drivers/media/usb/usbvision/usbvision-cards.c b/drivers/staging/media/usbvision/usbvision-cards.c
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision-cards.c
rename to drivers/staging/media/usbvision/usbvision-cards.c
diff --git a/drivers/media/usb/usbvision/usbvision-cards.h b/drivers/staging/media/usbvision/usbvision-cards.h
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision-cards.h
rename to drivers/staging/media/usbvision/usbvision-cards.h
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/staging/media/usbvision/usbvision-core.c
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision-core.c
rename to drivers/staging/media/usbvision/usbvision-core.c
diff --git a/drivers/media/usb/usbvision/usbvision-i2c.c b/drivers/staging/media/usbvision/usbvision-i2c.c
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision-i2c.c
rename to drivers/staging/media/usbvision/usbvision-i2c.c
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/staging/media/usbvision/usbvision-video.c
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision-video.c
rename to drivers/staging/media/usbvision/usbvision-video.c
diff --git a/drivers/media/usb/usbvision/usbvision.h b/drivers/staging/media/usbvision/usbvision.h
similarity index 100%
rename from drivers/media/usb/usbvision/usbvision.h
rename to drivers/staging/media/usbvision/usbvision.h
--
2.24.1
^ permalink raw reply related
* Re: [Xen-devel] [PATCH V3] x86/altp2m: Hypercall to set altp2m view visibility
From: George Dunlap @ 2020-02-20 12:21 UTC (permalink / raw)
To: Alexandru Stefan ISAILA, xen-devel@lists.xenproject.org
Cc: Kevin Tian, Stefano Stabellini, Julien Grall, Jun Nakajima,
Wei Liu, Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper,
Ian Jackson, Jan Beulich, Roger Pau Monné
In-Reply-To: <20200219091811.9689-1-aisaila@bitdefender.com>
On 2/19/20 9:18 AM, Alexandru Stefan ISAILA wrote:
> At this moment a guest can call vmfunc to change the altp2m view. This
> should be limited in order to avoid any unwanted view switch.
>
> The new xc_altp2m_set_visibility() solves this by making views invisible
> to vmfunc.
> This is done by having a separate arch.altp2m_working_eptp that is
> populated and made invalid in the same places as altp2m_eptp. This is
> written to EPTP_LIST_ADDR.
> The views are made in/visible by marking them with INVALID_MFN or
> copying them back from altp2m_eptp.
> To have consistency the visibility also applies to
> p2m_switch_domain_altp2m_by_id().
So it looks like by default the views are visible, until they're made
non-visible?
Also, does the last line mean that the toolstack can't change to a
"non-visible" altp2m either?
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.