+++ /dev/null
-From 8b3d743fc9e2542822826890b482afabf0e7522a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Mon, 20 Jun 2022 19:18:15 +0200
-Subject: clk: Fix pointer casting to prevent oops in devm_clk_release()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-commit 8b3d743fc9e2542822826890b482afabf0e7522a upstream.
-
-The release function is called with a pointer to the memory returned by
-devres_alloc(). I was confused about that by the code before the
-generalization that used a struct clk **ptr.
-
-Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
-Fixes: abae8e57e49a ("clk: generalize devm_clk_get() a bit")
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220620171815.114212-1-u.kleine-koenig@pengutronix.de
-Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
-Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/clk/clk-devres.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -11,7 +11,7 @@ struct devm_clk_state {
-
- static void devm_clk_release(struct device *dev, void *res)
- {
-- struct devm_clk_state *state = *(struct devm_clk_state **)res;
-+ struct devm_clk_state *state = res;
-
- if (state->exit)
- state->exit(state->clk);
+++ /dev/null
-From 2e8aa64321308cb222564b49311dffe42d4e98a3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 20 May 2022 09:57:35 +0200
-Subject: clk: generalize devm_clk_get() a bit
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit abae8e57e49aa75f6db76aa866c775721523908f ]
-
-Allow to add an exit hook to devm managed clocks. Also use
-clk_get_optional() in devm_clk_get_optional instead of open coding it.
-The generalisation will be used in the next commit to add some more
-devm_clk helpers.
-
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220520075737.758761-3-u.kleine-koenig@pengutronix.de
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/clk/clk-devres.c | 66 +++++++++++++++++++++++++++++-----------
- 1 file changed, 49 insertions(+), 17 deletions(-)
-
-diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
-index f9d5b7334341..c822f4ef1584 100644
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -4,39 +4,71 @@
- #include <linux/export.h>
- #include <linux/gfp.h>
-
-+struct devm_clk_state {
-+ struct clk *clk;
-+ void (*exit)(struct clk *clk);
-+};
-+
- static void devm_clk_release(struct device *dev, void *res)
- {
-- clk_put(*(struct clk **)res);
-+ struct devm_clk_state *state = *(struct devm_clk_state **)res;
-+
-+ if (state->exit)
-+ state->exit(state->clk);
-+
-+ clk_put(state->clk);
- }
-
--struct clk *devm_clk_get(struct device *dev, const char *id)
-+static struct clk *__devm_clk_get(struct device *dev, const char *id,
-+ struct clk *(*get)(struct device *dev, const char *id),
-+ int (*init)(struct clk *clk),
-+ void (*exit)(struct clk *clk))
- {
-- struct clk **ptr, *clk;
-+ struct devm_clk_state *state;
-+ struct clk *clk;
-+ int ret;
-
-- ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL);
-- if (!ptr)
-+ state = devres_alloc(devm_clk_release, sizeof(*state), GFP_KERNEL);
-+ if (!state)
- return ERR_PTR(-ENOMEM);
-
-- clk = clk_get(dev, id);
-- if (!IS_ERR(clk)) {
-- *ptr = clk;
-- devres_add(dev, ptr);
-- } else {
-- devres_free(ptr);
-+ clk = get(dev, id);
-+ if (IS_ERR(clk)) {
-+ ret = PTR_ERR(clk);
-+ goto err_clk_get;
- }
-
-+ if (init) {
-+ ret = init(clk);
-+ if (ret)
-+ goto err_clk_init;
-+ }
-+
-+ state->clk = clk;
-+ state->exit = exit;
-+
-+ devres_add(dev, state);
-+
- return clk;
-+
-+err_clk_init:
-+
-+ clk_put(clk);
-+err_clk_get:
-+
-+ devres_free(state);
-+ return ERR_PTR(ret);
-+}
-+
-+struct clk *devm_clk_get(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get);
-
- struct clk *devm_clk_get_optional(struct device *dev, const char *id)
- {
-- struct clk *clk = devm_clk_get(dev, id);
--
-- if (clk == ERR_PTR(-ENOENT))
-- return NULL;
--
-- return clk;
-+ return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get_optional);
-
---
-2.35.1
-
+++ /dev/null
-From 5cdb42187f1e07e14a09a565710d05bf335f0a31 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 20 May 2022 09:57:36 +0200
-Subject: clk: Provide new devm_clk helpers for prepared and enabled clocks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 7ef9651e9792b08eb310c6beb202cbc947f43cab ]
-
-When a driver keeps a clock prepared (or enabled) during the whole
-lifetime of the driver, these helpers allow to simplify the drivers.
-
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220520075737.758761-4-u.kleine-koenig@pengutronix.de
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/clk/clk-devres.c | 27 ++++++++++
- include/linux/clk.h | 109 +++++++++++++++++++++++++++++++++++++++
- 2 files changed, 136 insertions(+)
-
-diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
-index c822f4ef1584..43ccd20e0298 100644
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -66,12 +66,39 @@ struct clk *devm_clk_get(struct device *dev, const char *id)
- }
- EXPORT_SYMBOL(devm_clk_get);
-
-+struct clk *devm_clk_get_prepared(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get, clk_prepare, clk_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_prepared);
-+
-+struct clk *devm_clk_get_enabled(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get,
-+ clk_prepare_enable, clk_disable_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_enabled);
-+
- struct clk *devm_clk_get_optional(struct device *dev, const char *id)
- {
- return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get_optional);
-
-+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get_optional,
-+ clk_prepare, clk_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_optional_prepared);
-+
-+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get_optional,
-+ clk_prepare_enable, clk_disable_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled);
-+
- struct clk_bulk_devres {
- struct clk_bulk_data *clks;
- int num_clks;
-diff --git a/include/linux/clk.h b/include/linux/clk.h
-index 7fd6a1febcf4..1814eabb7c20 100644
---- a/include/linux/clk.h
-+++ b/include/linux/clk.h
-@@ -418,6 +418,47 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
- */
- struct clk *devm_clk_get(struct device *dev, const char *id);
-
-+/**
-+ * devm_clk_get_prepared - devm_clk_get() + clk_prepare()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. (IOW, @id may be identical strings, but
-+ * clk_get may return different clock producers depending on @dev.)
-+ *
-+ * The returned clk (if valid) is prepared. Drivers must however assume
-+ * that the clock is not enabled.
-+ *
-+ * The clock will automatically be unprepared and freed when the device
-+ * is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_prepared(struct device *dev, const char *id);
-+
-+/**
-+ * devm_clk_get_enabled - devm_clk_get() + clk_prepare_enable()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. (IOW, @id may be identical strings, but
-+ * clk_get may return different clock producers depending on @dev.)
-+ *
-+ * The returned clk (if valid) is prepared and enabled.
-+ *
-+ * The clock will automatically be disabled, unprepared and freed
-+ * when the device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_enabled(struct device *dev, const char *id);
-+
- /**
- * devm_clk_get_optional - lookup and obtain a managed reference to an optional
- * clock producer.
-@@ -429,6 +470,50 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
- */
- struct clk *devm_clk_get_optional(struct device *dev, const char *id);
-
-+/**
-+ * devm_clk_get_optional_prepared - devm_clk_get_optional() + clk_prepare()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. If no such clk is found, it returns NULL
-+ * which serves as a dummy clk. That's the only difference compared
-+ * to devm_clk_get_prepared().
-+ *
-+ * The returned clk (if valid) is prepared. Drivers must however
-+ * assume that the clock is not enabled.
-+ *
-+ * The clock will automatically be unprepared and freed when the
-+ * device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id);
-+
-+/**
-+ * devm_clk_get_optional_enabled - devm_clk_get_optional() +
-+ * clk_prepare_enable()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. If no such clk is found, it returns NULL
-+ * which serves as a dummy clk. That's the only difference compared
-+ * to devm_clk_get_enabled().
-+ *
-+ * The returned clk (if valid) is prepared and enabled.
-+ *
-+ * The clock will automatically be disabled, unprepared and freed
-+ * when the device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id);
-+
- /**
- * devm_get_clk_from_child - lookup and obtain a managed reference to a
- * clock producer from child node.
-@@ -773,12 +858,36 @@ static inline struct clk *devm_clk_get(struct device *dev, const char *id)
- return NULL;
- }
-
-+static inline struct clk *devm_clk_get_prepared(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
-+static inline struct clk *devm_clk_get_enabled(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
- static inline struct clk *devm_clk_get_optional(struct device *dev,
- const char *id)
- {
- return NULL;
- }
-
-+static inline struct clk *devm_clk_get_optional_prepared(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
-+static inline struct clk *devm_clk_get_optional_enabled(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
- static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
- struct clk_bulk_data *clks)
- {
---
-2.35.1
-
-From 0bceec0c8d440530c868e7df0f5c554880f2be7a Mon Sep 17 00:00:00 2001
+From 3324a30eba930652090561a7b03197e943d09fb8 Mon Sep 17 00:00:00 2001
From: Sasha Levin <sashal@kernel.org>
Date: Mon, 22 Aug 2022 13:19:03 +0200
Subject: hwrng: imx-rngc - Moving IRQ handler registering after
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/char/hw_random/imx-rngc.c | 14 +++++++-------
+ drivers/char/hw_random/imx-rngc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
-diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
-index f63dd08a4f37..02665ccf6ae7 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
-@@ -266,13 +266,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
- if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB)
- return -ENODEV;
+@@ -272,13 +272,6 @@ static int imx_rngc_probe(struct platfor
+ goto err;
+ }
- ret = devm_request_irq(&pdev->dev,
- irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
- if (ret) {
- dev_err(rngc->dev, "Can't get interrupt working.\n");
-- return ret;
+- goto err;
- }
-
init_completion(&rngc->rng_op_done);
rngc->rng.name = pdev->name;
-@@ -286,6 +279,13 @@ static int imx_rngc_probe(struct platform_device *pdev)
+@@ -292,6 +285,13 @@ static int imx_rngc_probe(struct platfor
imx_rngc_irq_mask_clear(rngc);
if (self_test) {
ret = imx_rngc_self_test(rngc);
if (ret) {
---
-2.35.1
-
+++ /dev/null
-From 250c01ab3ce931002b51ce492b88a8bb596fd358 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Aug 2022 21:37:42 +0200
-Subject: hwrng: imx-rngc - use devm_clk_get_enabled
-
-From: Martin Kaiser <martin@kaiser.cx>
-
-[ Upstream commit 6a2bc448423cea44e7dba0f72d7c82ae04ab201e ]
-
-Use the new devm_clk_get_enabled function to get our clock.
-
-We don't have to disable and unprepare the clock ourselves any more in
-error paths and in the remove function.
-
-Signed-off-by: Martin Kaiser <martin@kaiser.cx>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/char/hw_random/imx-rngc.c | 25 ++++++-------------------
- 1 file changed, 6 insertions(+), 19 deletions(-)
-
-diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
-index 61c844baf26e..f63dd08a4f37 100644
---- a/drivers/char/hw_random/imx-rngc.c
-+++ b/drivers/char/hw_random/imx-rngc.c
-@@ -245,7 +245,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
- if (IS_ERR(rngc->base))
- return PTR_ERR(rngc->base);
-
-- rngc->clk = devm_clk_get(&pdev->dev, NULL);
-+ rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
- if (IS_ERR(rngc->clk)) {
- dev_err(&pdev->dev, "Can not get rng_clk\n");
- return PTR_ERR(rngc->clk);
-@@ -257,26 +257,20 @@ static int imx_rngc_probe(struct platform_device *pdev)
- return irq;
- }
-
-- ret = clk_prepare_enable(rngc->clk);
-- if (ret)
-- return ret;
--
- ver_id = readl(rngc->base + RNGC_VER_ID);
- rng_type = ver_id >> RNGC_TYPE_SHIFT;
- /*
- * This driver supports only RNGC and RNGB. (There's a different
- * driver for RNGA.)
- */
-- if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) {
-- ret = -ENODEV;
-- goto err;
-- }
-+ if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB)
-+ return -ENODEV;
-
- ret = devm_request_irq(&pdev->dev,
- irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
- if (ret) {
- dev_err(rngc->dev, "Can't get interrupt working.\n");
-- goto err;
-+ return ret;
- }
-
- init_completion(&rngc->rng_op_done);
-@@ -296,14 +290,14 @@ static int imx_rngc_probe(struct platform_device *pdev)
- ret = imx_rngc_self_test(rngc);
- if (ret) {
- dev_err(rngc->dev, "self test failed\n");
-- goto err;
-+ return ret;
- }
- }
-
- ret = hwrng_register(&rngc->rng);
- if (ret) {
- dev_err(&pdev->dev, "hwrng registration failed\n");
-- goto err;
-+ return ret;
- }
-
- dev_info(&pdev->dev,
-@@ -311,11 +305,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
- rng_type == RNGC_TYPE_RNGB ? 'B' : 'C',
- (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff);
- return 0;
--
--err:
-- clk_disable_unprepare(rngc->clk);
--
-- return ret;
- }
-
- static int __exit imx_rngc_remove(struct platform_device *pdev)
-@@ -324,8 +313,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev)
-
- hwrng_unregister(&rngc->rng);
-
-- clk_disable_unprepare(rngc->clk);
--
- return 0;
- }
-
---
-2.35.1
-
+++ /dev/null
-From 2d853043954ab12ddb74bedfbe14b11cb27722b4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:54 +0000
-Subject: KVM: nVMX: Prioritize TSS T-flag #DBs over Monitor Trap Flag
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit b9d44f9091ac6c325fc2f7b7671b462fb36abbed ]
-
-Service TSS T-flag #DBs prior to pending MTFs, as such #DBs are higher
-priority than MTF. KVM itself doesn't emulate TSS #DBs, and any such
-exceptions injected from L1 will be handled by hardware (or morphed to
-a fault-like exception if injection fails), but theoretically userspace
-could pend a TSS T-flag #DB in conjunction with a pending MTF.
-
-Note, there's no known use case this fixes, it's purely to be technically
-correct with respect to Intel's SDM.
-
-Cc: Oliver Upton <oupton@google.com>
-Cc: Peter Shier <pshier@google.com>
-Fixes: 5ef8acbdd687 ("KVM: nVMX: Emulate MTF when performing instruction emulation")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-8-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index 9e17b7a89c4a..75117c625b62 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3875,15 +3875,17 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- }
-
- /*
-- * Process any exceptions that are not debug traps before MTF.
-+ * Process exceptions that are higher priority than Monitor Trap Flag:
-+ * fault-like exceptions, TSS T flag #DB (not emulated by KVM, but
-+ * could theoretically come in from userspace), and ICEBP (INT1).
- *
- * Note that only a pending nested run can block a pending exception.
- * Otherwise an injected NMI/interrupt should either be
- * lost or delivered to the nested hypervisor in the IDT_VECTORING_INFO,
- * while delivering the pending exception.
- */
--
-- if (vcpu->arch.exception.pending && !vmx_get_pending_dbg_trap(vcpu)) {
-+ if (vcpu->arch.exception.pending &&
-+ !(vmx_get_pending_dbg_trap(vcpu) & ~DR6_BT)) {
- if (vmx->nested.nested_run_pending)
- return -EBUSY;
- if (!nested_vmx_check_exception(vcpu, &exit_qual))
---
-2.35.1
-
+++ /dev/null
-From 9446b7ee3614175723ffa363b04b39867947ae15 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:53 +0000
-Subject: KVM: nVMX: Treat General Detect #DB (DR7.GD=1) as fault-like
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit 8d178f460772ecdee8e6d72389b43a8d35a14ff5 ]
-
-Exclude General Detect #DBs, which have fault-like behavior but also have
-a non-zero payload (DR6.BD=1), from nVMX's handling of pending debug
-traps. Opportunistically rewrite the comment to better document what is
-being checked, i.e. "has a non-zero payload" vs. "has a payload", and to
-call out the many caveats surrounding #DBs that KVM dodges one way or
-another.
-
-Cc: Oliver Upton <oupton@google.com>
-Cc: Peter Shier <pshier@google.com>
-Fixes: 684c0422da71 ("KVM: nVMX: Handle pending #DB when injecting INIT VM-exit")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-7-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 36 +++++++++++++++++++++++++-----------
- 1 file changed, 25 insertions(+), 11 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index 313ace5dc75b..9e17b7a89c4a 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3802,16 +3802,29 @@ static void nested_vmx_inject_exception_vmexit(struct kvm_vcpu *vcpu,
- }
-
- /*
-- * Returns true if a debug trap is pending delivery.
-+ * Returns true if a debug trap is (likely) pending delivery. Infer the class
-+ * of a #DB (trap-like vs. fault-like) from the exception payload (to-be-DR6).
-+ * Using the payload is flawed because code breakpoints (fault-like) and data
-+ * breakpoints (trap-like) set the same bits in DR6 (breakpoint detected), i.e.
-+ * this will return false positives if a to-be-injected code breakpoint #DB is
-+ * pending (from KVM's perspective, but not "pending" across an instruction
-+ * boundary). ICEBP, a.k.a. INT1, is also not reflected here even though it
-+ * too is trap-like.
- *
-- * In KVM, debug traps bear an exception payload. As such, the class of a #DB
-- * exception may be inferred from the presence of an exception payload.
-+ * KVM "works" despite these flaws as ICEBP isn't currently supported by the
-+ * emulator, Monitor Trap Flag is not marked pending on intercepted #DBs (the
-+ * #DB has already happened), and MTF isn't marked pending on code breakpoints
-+ * from the emulator (because such #DBs are fault-like and thus don't trigger
-+ * actions that fire on instruction retire).
- */
--static inline bool vmx_pending_dbg_trap(struct kvm_vcpu *vcpu)
-+static inline unsigned long vmx_get_pending_dbg_trap(struct kvm_vcpu *vcpu)
- {
-- return vcpu->arch.exception.pending &&
-- vcpu->arch.exception.nr == DB_VECTOR &&
-- vcpu->arch.exception.payload;
-+ if (!vcpu->arch.exception.pending ||
-+ vcpu->arch.exception.nr != DB_VECTOR)
-+ return 0;
-+
-+ /* General Detect #DBs are always fault-like. */
-+ return vcpu->arch.exception.payload & ~DR6_BD;
- }
-
- /*
-@@ -3823,9 +3836,10 @@ static inline bool vmx_pending_dbg_trap(struct kvm_vcpu *vcpu)
- */
- static void nested_vmx_update_pending_dbg(struct kvm_vcpu *vcpu)
- {
-- if (vmx_pending_dbg_trap(vcpu))
-- vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
-- vcpu->arch.exception.payload);
-+ unsigned long pending_dbg = vmx_get_pending_dbg_trap(vcpu);
-+
-+ if (pending_dbg)
-+ vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, pending_dbg);
- }
-
- static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu)
-@@ -3869,7 +3883,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- * while delivering the pending exception.
- */
-
-- if (vcpu->arch.exception.pending && !vmx_pending_dbg_trap(vcpu)) {
-+ if (vcpu->arch.exception.pending && !vmx_get_pending_dbg_trap(vcpu)) {
- if (vmx->nested.nested_run_pending)
- return -EBUSY;
- if (!nested_vmx_check_exception(vcpu, &exit_qual))
---
-2.35.1
-
+++ /dev/null
-From 09a1003ff5a10abef7dafb153b0fea05c19e3ff9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Aug 2022 14:32:37 +0800
-Subject: KVM: x86/mmu: fix memoryleak in kvm_mmu_vendor_module_init()
-
-From: Miaohe Lin <linmiaohe@huawei.com>
-
-[ Upstream commit d7c9bfb9caaffd496ae44b258ec7c793677d3eeb ]
-
-When register_shrinker() fails, KVM doesn't release the percpu counter
-kvm_total_used_mmu_pages leading to memoryleak. Fix this issue by calling
-percpu_counter_destroy() when register_shrinker() fails.
-
-Fixes: ab271bd4dfd5 ("x86: kvm: propagate register_shrinker return code")
-Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
-Link: https://lore.kernel.org/r/20220823063237.47299-1-linmiaohe@huawei.com
-[sean: tweak shortlog and changelog]
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/mmu/mmu.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
-index 13bf3198d0ce..982529bcdf30 100644
---- a/arch/x86/kvm/mmu/mmu.c
-+++ b/arch/x86/kvm/mmu/mmu.c
-@@ -5932,10 +5932,12 @@ int kvm_mmu_vendor_module_init(void)
-
- ret = register_shrinker(&mmu_shrinker);
- if (ret)
-- goto out;
-+ goto out_shrinker;
-
- return 0;
-
-+out_shrinker:
-+ percpu_counter_destroy(&kvm_total_used_mmu_pages);
- out:
- mmu_destroy_caches();
- return ret;
---
-2.35.1
-
clk-ti-dra7-atl-fix-reference-leak-in-of_dra7_atl_cl.patch
clk-ast2600-bclk-comes-from-epll.patch
mailbox-bcm-ferxrm-mailbox-fix-error-check-for-dma_m.patch
-kvm-x86-mmu-fix-memoryleak-in-kvm_mmu_vendor_module_.patch
powerpc-math_emu-efp-include-module.h.patch
powerpc-sysdev-fsl_msi-add-missing-of_node_put.patch
powerpc-pci_dn-add-missing-of_node_put.patch
powerpc-powernv-add-missing-of_node_put-in-opal_expo.patch
x86-hyperv-fix-struct-hv_enlightened_vmcs-definition.patch
kvm-x86-pending-exceptions-must-not-be-blocked-by-an.patch
-kvm-nvmx-treat-general-detect-db-dr7.gd-1-as-fault-l.patch
-kvm-nvmx-prioritize-tss-t-flag-dbs-over-monitor-trap.patch
powerpc-64s-fix-generic_cpu-build-flags-for-ppc970-g.patch
powerpc-fix-spe-power-isa-properties-for-e500v1-plat.patch
powerpc-lib-code-patching-don-t-use-struct-ppc_inst-.patch
scsi-cgroup-add-cgroup_get_from_id.patch
cgroup-reduce-dependency-on-cgroup_mutex.patch
cgroup-honor-caller-s-cgroup-ns-when-resolving-path.patch
-clk-generalize-devm_clk_get-a-bit.patch
-clk-provide-new-devm_clk-helpers-for-prepared-and-en.patch
-hwrng-imx-rngc-use-devm_clk_get_enabled.patch
hwrng-imx-rngc-moving-irq-handler-registering-after-.patch
cgroup-cpuset-enable-update_tasks_cpumask-on-top_cpu.patch
iommu-omap-fix-buffer-overflow-in-debugfs.patch
net-ieee802154-return-einval-for-unknown-addr-type.patch
revert-net-ieee802154-reject-zero-sized-raw_sendmsg.patch
net-ieee802154-don-t-warn-zero-sized-raw_sendmsg.patch
-clk-fix-pointer-casting-to-prevent-oops-in-devm_clk_release.patch
net-wwan-t7xx-use-gfp_atomic-under-spin-lock-in-t7xx_cldma_gpd_set_next_ptr.patch
revert-drm-amdgpu-move-nbio-sdma_doorbell_range-into-sdma-code-for-vega.patch
revert-drm-amdgpu-use-dirty-framebuffer-helper.patch
+++ /dev/null
-From 8b3d743fc9e2542822826890b482afabf0e7522a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Mon, 20 Jun 2022 19:18:15 +0200
-Subject: clk: Fix pointer casting to prevent oops in devm_clk_release()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-commit 8b3d743fc9e2542822826890b482afabf0e7522a upstream.
-
-The release function is called with a pointer to the memory returned by
-devres_alloc(). I was confused about that by the code before the
-generalization that used a struct clk **ptr.
-
-Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
-Fixes: abae8e57e49a ("clk: generalize devm_clk_get() a bit")
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220620171815.114212-1-u.kleine-koenig@pengutronix.de
-Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
-Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/clk/clk-devres.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -11,7 +11,7 @@ struct devm_clk_state {
-
- static void devm_clk_release(struct device *dev, void *res)
- {
-- struct devm_clk_state *state = *(struct devm_clk_state **)res;
-+ struct devm_clk_state *state = res;
-
- if (state->exit)
- state->exit(state->clk);
+++ /dev/null
-From 90f211f7712a91e96b004695da40fb739c2daf12 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 20 May 2022 09:57:35 +0200
-Subject: clk: generalize devm_clk_get() a bit
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit abae8e57e49aa75f6db76aa866c775721523908f ]
-
-Allow to add an exit hook to devm managed clocks. Also use
-clk_get_optional() in devm_clk_get_optional instead of open coding it.
-The generalisation will be used in the next commit to add some more
-devm_clk helpers.
-
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220520075737.758761-3-u.kleine-koenig@pengutronix.de
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/clk/clk-devres.c | 66 +++++++++++++++++++++++++++++-----------
- 1 file changed, 49 insertions(+), 17 deletions(-)
-
-diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
-index f9d5b7334341..c822f4ef1584 100644
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -4,39 +4,71 @@
- #include <linux/export.h>
- #include <linux/gfp.h>
-
-+struct devm_clk_state {
-+ struct clk *clk;
-+ void (*exit)(struct clk *clk);
-+};
-+
- static void devm_clk_release(struct device *dev, void *res)
- {
-- clk_put(*(struct clk **)res);
-+ struct devm_clk_state *state = *(struct devm_clk_state **)res;
-+
-+ if (state->exit)
-+ state->exit(state->clk);
-+
-+ clk_put(state->clk);
- }
-
--struct clk *devm_clk_get(struct device *dev, const char *id)
-+static struct clk *__devm_clk_get(struct device *dev, const char *id,
-+ struct clk *(*get)(struct device *dev, const char *id),
-+ int (*init)(struct clk *clk),
-+ void (*exit)(struct clk *clk))
- {
-- struct clk **ptr, *clk;
-+ struct devm_clk_state *state;
-+ struct clk *clk;
-+ int ret;
-
-- ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL);
-- if (!ptr)
-+ state = devres_alloc(devm_clk_release, sizeof(*state), GFP_KERNEL);
-+ if (!state)
- return ERR_PTR(-ENOMEM);
-
-- clk = clk_get(dev, id);
-- if (!IS_ERR(clk)) {
-- *ptr = clk;
-- devres_add(dev, ptr);
-- } else {
-- devres_free(ptr);
-+ clk = get(dev, id);
-+ if (IS_ERR(clk)) {
-+ ret = PTR_ERR(clk);
-+ goto err_clk_get;
- }
-
-+ if (init) {
-+ ret = init(clk);
-+ if (ret)
-+ goto err_clk_init;
-+ }
-+
-+ state->clk = clk;
-+ state->exit = exit;
-+
-+ devres_add(dev, state);
-+
- return clk;
-+
-+err_clk_init:
-+
-+ clk_put(clk);
-+err_clk_get:
-+
-+ devres_free(state);
-+ return ERR_PTR(ret);
-+}
-+
-+struct clk *devm_clk_get(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get);
-
- struct clk *devm_clk_get_optional(struct device *dev, const char *id)
- {
-- struct clk *clk = devm_clk_get(dev, id);
--
-- if (clk == ERR_PTR(-ENOENT))
-- return NULL;
--
-- return clk;
-+ return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get_optional);
-
---
-2.35.1
-
+++ /dev/null
-From 94b670190d8ed6d1a3fd9aad041f8ad631c92b0b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 20 May 2022 09:57:36 +0200
-Subject: clk: Provide new devm_clk helpers for prepared and enabled clocks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 7ef9651e9792b08eb310c6beb202cbc947f43cab ]
-
-When a driver keeps a clock prepared (or enabled) during the whole
-lifetime of the driver, these helpers allow to simplify the drivers.
-
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20220520075737.758761-4-u.kleine-koenig@pengutronix.de
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/clk/clk-devres.c | 27 ++++++++++
- include/linux/clk.h | 109 +++++++++++++++++++++++++++++++++++++++
- 2 files changed, 136 insertions(+)
-
-diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
-index c822f4ef1584..43ccd20e0298 100644
---- a/drivers/clk/clk-devres.c
-+++ b/drivers/clk/clk-devres.c
-@@ -66,12 +66,39 @@ struct clk *devm_clk_get(struct device *dev, const char *id)
- }
- EXPORT_SYMBOL(devm_clk_get);
-
-+struct clk *devm_clk_get_prepared(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get, clk_prepare, clk_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_prepared);
-+
-+struct clk *devm_clk_get_enabled(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get,
-+ clk_prepare_enable, clk_disable_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_enabled);
-+
- struct clk *devm_clk_get_optional(struct device *dev, const char *id)
- {
- return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
- }
- EXPORT_SYMBOL(devm_clk_get_optional);
-
-+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get_optional,
-+ clk_prepare, clk_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_optional_prepared);
-+
-+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id)
-+{
-+ return __devm_clk_get(dev, id, clk_get_optional,
-+ clk_prepare_enable, clk_disable_unprepare);
-+}
-+EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled);
-+
- struct clk_bulk_devres {
- struct clk_bulk_data *clks;
- int num_clks;
-diff --git a/include/linux/clk.h b/include/linux/clk.h
-index 266e8de3cb51..e280e0acb55c 100644
---- a/include/linux/clk.h
-+++ b/include/linux/clk.h
-@@ -458,6 +458,47 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
- */
- struct clk *devm_clk_get(struct device *dev, const char *id);
-
-+/**
-+ * devm_clk_get_prepared - devm_clk_get() + clk_prepare()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. (IOW, @id may be identical strings, but
-+ * clk_get may return different clock producers depending on @dev.)
-+ *
-+ * The returned clk (if valid) is prepared. Drivers must however assume
-+ * that the clock is not enabled.
-+ *
-+ * The clock will automatically be unprepared and freed when the device
-+ * is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_prepared(struct device *dev, const char *id);
-+
-+/**
-+ * devm_clk_get_enabled - devm_clk_get() + clk_prepare_enable()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. (IOW, @id may be identical strings, but
-+ * clk_get may return different clock producers depending on @dev.)
-+ *
-+ * The returned clk (if valid) is prepared and enabled.
-+ *
-+ * The clock will automatically be disabled, unprepared and freed
-+ * when the device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_enabled(struct device *dev, const char *id);
-+
- /**
- * devm_clk_get_optional - lookup and obtain a managed reference to an optional
- * clock producer.
-@@ -469,6 +510,50 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
- */
- struct clk *devm_clk_get_optional(struct device *dev, const char *id);
-
-+/**
-+ * devm_clk_get_optional_prepared - devm_clk_get_optional() + clk_prepare()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. If no such clk is found, it returns NULL
-+ * which serves as a dummy clk. That's the only difference compared
-+ * to devm_clk_get_prepared().
-+ *
-+ * The returned clk (if valid) is prepared. Drivers must however
-+ * assume that the clock is not enabled.
-+ *
-+ * The clock will automatically be unprepared and freed when the
-+ * device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id);
-+
-+/**
-+ * devm_clk_get_optional_enabled - devm_clk_get_optional() +
-+ * clk_prepare_enable()
-+ * @dev: device for clock "consumer"
-+ * @id: clock consumer ID
-+ *
-+ * Context: May sleep.
-+ *
-+ * Return: a struct clk corresponding to the clock producer, or
-+ * valid IS_ERR() condition containing errno. The implementation
-+ * uses @dev and @id to determine the clock consumer, and thereby
-+ * the clock producer. If no such clk is found, it returns NULL
-+ * which serves as a dummy clk. That's the only difference compared
-+ * to devm_clk_get_enabled().
-+ *
-+ * The returned clk (if valid) is prepared and enabled.
-+ *
-+ * The clock will automatically be disabled, unprepared and freed
-+ * when the device is unbound from the bus.
-+ */
-+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id);
-+
- /**
- * devm_get_clk_from_child - lookup and obtain a managed reference to a
- * clock producer from child node.
-@@ -813,12 +898,36 @@ static inline struct clk *devm_clk_get(struct device *dev, const char *id)
- return NULL;
- }
-
-+static inline struct clk *devm_clk_get_prepared(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
-+static inline struct clk *devm_clk_get_enabled(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
- static inline struct clk *devm_clk_get_optional(struct device *dev,
- const char *id)
- {
- return NULL;
- }
-
-+static inline struct clk *devm_clk_get_optional_prepared(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
-+static inline struct clk *devm_clk_get_optional_enabled(struct device *dev,
-+ const char *id)
-+{
-+ return NULL;
-+}
-+
- static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
- struct clk_bulk_data *clks)
- {
---
-2.35.1
-
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/char/hw_random/imx-rngc.c | 14 +++++++-------
+ drivers/char/hw_random/imx-rngc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
-diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
-index e32c52c10d4d..1d7ce7443586 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
-@@ -264,13 +264,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
- if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB)
- return -ENODEV;
+@@ -270,13 +270,6 @@ static int imx_rngc_probe(struct platfor
+ goto err;
+ }
- ret = devm_request_irq(&pdev->dev,
- irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
- if (ret) {
- dev_err(rngc->dev, "Can't get interrupt working.\n");
-- return ret;
+- goto err;
- }
-
init_completion(&rngc->rng_op_done);
rngc->rng.name = pdev->name;
-@@ -284,6 +277,13 @@ static int imx_rngc_probe(struct platform_device *pdev)
+@@ -290,6 +283,13 @@ static int imx_rngc_probe(struct platfor
imx_rngc_irq_mask_clear(rngc);
if (self_test) {
ret = imx_rngc_self_test(rngc);
if (ret) {
---
-2.35.1
-
+++ /dev/null
-From 76048f815f7b87bfbaac9ce3e29853810a202a96 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Aug 2022 21:37:42 +0200
-Subject: hwrng: imx-rngc - use devm_clk_get_enabled
-
-From: Martin Kaiser <martin@kaiser.cx>
-
-[ Upstream commit 6a2bc448423cea44e7dba0f72d7c82ae04ab201e ]
-
-Use the new devm_clk_get_enabled function to get our clock.
-
-We don't have to disable and unprepare the clock ourselves any more in
-error paths and in the remove function.
-
-Signed-off-by: Martin Kaiser <martin@kaiser.cx>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/char/hw_random/imx-rngc.c | 25 ++++++-------------------
- 1 file changed, 6 insertions(+), 19 deletions(-)
-
-diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
-index b05d676ca814..e32c52c10d4d 100644
---- a/drivers/char/hw_random/imx-rngc.c
-+++ b/drivers/char/hw_random/imx-rngc.c
-@@ -245,7 +245,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
- if (IS_ERR(rngc->base))
- return PTR_ERR(rngc->base);
-
-- rngc->clk = devm_clk_get(&pdev->dev, NULL);
-+ rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
- if (IS_ERR(rngc->clk)) {
- dev_err(&pdev->dev, "Can not get rng_clk\n");
- return PTR_ERR(rngc->clk);
-@@ -255,26 +255,20 @@ static int imx_rngc_probe(struct platform_device *pdev)
- if (irq < 0)
- return irq;
-
-- ret = clk_prepare_enable(rngc->clk);
-- if (ret)
-- return ret;
--
- ver_id = readl(rngc->base + RNGC_VER_ID);
- rng_type = ver_id >> RNGC_TYPE_SHIFT;
- /*
- * This driver supports only RNGC and RNGB. (There's a different
- * driver for RNGA.)
- */
-- if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) {
-- ret = -ENODEV;
-- goto err;
-- }
-+ if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB)
-+ return -ENODEV;
-
- ret = devm_request_irq(&pdev->dev,
- irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
- if (ret) {
- dev_err(rngc->dev, "Can't get interrupt working.\n");
-- goto err;
-+ return ret;
- }
-
- init_completion(&rngc->rng_op_done);
-@@ -294,14 +288,14 @@ static int imx_rngc_probe(struct platform_device *pdev)
- ret = imx_rngc_self_test(rngc);
- if (ret) {
- dev_err(rngc->dev, "self test failed\n");
-- goto err;
-+ return ret;
- }
- }
-
- ret = hwrng_register(&rngc->rng);
- if (ret) {
- dev_err(&pdev->dev, "hwrng registration failed\n");
-- goto err;
-+ return ret;
- }
-
- dev_info(&pdev->dev,
-@@ -309,11 +303,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
- rng_type == RNGC_TYPE_RNGB ? 'B' : 'C',
- (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff);
- return 0;
--
--err:
-- clk_disable_unprepare(rngc->clk);
--
-- return ret;
- }
-
- static int __exit imx_rngc_remove(struct platform_device *pdev)
-@@ -322,8 +311,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev)
-
- hwrng_unregister(&rngc->rng);
-
-- clk_disable_unprepare(rngc->clk);
--
- return 0;
- }
-
---
-2.35.1
-
+++ /dev/null
-From 51b10feea42fbc06adb530d6ff180f2ab0473d48 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:57 +0000
-Subject: KVM: nVMX: Ignore SIPI that arrives in L2 when vCPU is not in WFS
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit c2086eca86585bfd8132dd91e802497a202185c8 ]
-
-Fall through to handling other pending exception/events for L2 if SIPI
-is pending while the CPU is not in Wait-for-SIPI. KVM correctly ignores
-the event, but incorrectly returns immediately, e.g. a SIPI coincident
-with another event could lead to KVM incorrectly routing the event to L1
-instead of L2.
-
-Fixes: bf0cd88ce363 ("KVM: x86: emulate wait-for-SIPI and SIPI-VMExit")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-11-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index f28085b89f47..94b4b3d306ce 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3931,10 +3931,12 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- return -EBUSY;
-
- clear_bit(KVM_APIC_SIPI, &apic->pending_events);
-- if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED)
-+ if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
- nested_vmx_vmexit(vcpu, EXIT_REASON_SIPI_SIGNAL, 0,
- apic->sipi_vector & 0xFFUL);
-- return 0;
-+ return 0;
-+ }
-+ /* Fallthrough, the SIPI is completely ignored. */
- }
-
- /*
---
-2.35.1
-
+++ /dev/null
-From c09b39bc2c9bfd8e2bdf4966c48c353b4e4a5127 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:54 +0000
-Subject: KVM: nVMX: Prioritize TSS T-flag #DBs over Monitor Trap Flag
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit b9d44f9091ac6c325fc2f7b7671b462fb36abbed ]
-
-Service TSS T-flag #DBs prior to pending MTFs, as such #DBs are higher
-priority than MTF. KVM itself doesn't emulate TSS #DBs, and any such
-exceptions injected from L1 will be handled by hardware (or morphed to
-a fault-like exception if injection fails), but theoretically userspace
-could pend a TSS T-flag #DB in conjunction with a pending MTF.
-
-Note, there's no known use case this fixes, it's purely to be technically
-correct with respect to Intel's SDM.
-
-Cc: Oliver Upton <oupton@google.com>
-Cc: Peter Shier <pshier@google.com>
-Fixes: 5ef8acbdd687 ("KVM: nVMX: Emulate MTF when performing instruction emulation")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-8-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index cdbe827ec960..f28085b89f47 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3938,15 +3938,17 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- }
-
- /*
-- * Process any exceptions that are not debug traps before MTF.
-+ * Process exceptions that are higher priority than Monitor Trap Flag:
-+ * fault-like exceptions, TSS T flag #DB (not emulated by KVM, but
-+ * could theoretically come in from userspace), and ICEBP (INT1).
- *
- * Note that only a pending nested run can block a pending exception.
- * Otherwise an injected NMI/interrupt should either be
- * lost or delivered to the nested hypervisor in the IDT_VECTORING_INFO,
- * while delivering the pending exception.
- */
--
-- if (vcpu->arch.exception.pending && !vmx_get_pending_dbg_trap(vcpu)) {
-+ if (vcpu->arch.exception.pending &&
-+ !(vmx_get_pending_dbg_trap(vcpu) & ~DR6_BT)) {
- if (vmx->nested.nested_run_pending)
- return -EBUSY;
- if (!nested_vmx_check_exception(vcpu, &exit_qual))
---
-2.35.1
-
+++ /dev/null
-From 9d78e1016b5b9581ab29294a2b3759df469bf66f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:53 +0000
-Subject: KVM: nVMX: Treat General Detect #DB (DR7.GD=1) as fault-like
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit 8d178f460772ecdee8e6d72389b43a8d35a14ff5 ]
-
-Exclude General Detect #DBs, which have fault-like behavior but also have
-a non-zero payload (DR6.BD=1), from nVMX's handling of pending debug
-traps. Opportunistically rewrite the comment to better document what is
-being checked, i.e. "has a non-zero payload" vs. "has a payload", and to
-call out the many caveats surrounding #DBs that KVM dodges one way or
-another.
-
-Cc: Oliver Upton <oupton@google.com>
-Cc: Peter Shier <pshier@google.com>
-Fixes: 684c0422da71 ("KVM: nVMX: Handle pending #DB when injecting INIT VM-exit")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-7-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 36 +++++++++++++++++++++++++-----------
- 1 file changed, 25 insertions(+), 11 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index 91b182fafb43..cdbe827ec960 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3852,16 +3852,29 @@ static void nested_vmx_inject_exception_vmexit(struct kvm_vcpu *vcpu,
- }
-
- /*
-- * Returns true if a debug trap is pending delivery.
-+ * Returns true if a debug trap is (likely) pending delivery. Infer the class
-+ * of a #DB (trap-like vs. fault-like) from the exception payload (to-be-DR6).
-+ * Using the payload is flawed because code breakpoints (fault-like) and data
-+ * breakpoints (trap-like) set the same bits in DR6 (breakpoint detected), i.e.
-+ * this will return false positives if a to-be-injected code breakpoint #DB is
-+ * pending (from KVM's perspective, but not "pending" across an instruction
-+ * boundary). ICEBP, a.k.a. INT1, is also not reflected here even though it
-+ * too is trap-like.
- *
-- * In KVM, debug traps bear an exception payload. As such, the class of a #DB
-- * exception may be inferred from the presence of an exception payload.
-+ * KVM "works" despite these flaws as ICEBP isn't currently supported by the
-+ * emulator, Monitor Trap Flag is not marked pending on intercepted #DBs (the
-+ * #DB has already happened), and MTF isn't marked pending on code breakpoints
-+ * from the emulator (because such #DBs are fault-like and thus don't trigger
-+ * actions that fire on instruction retire).
- */
--static inline bool vmx_pending_dbg_trap(struct kvm_vcpu *vcpu)
-+static inline unsigned long vmx_get_pending_dbg_trap(struct kvm_vcpu *vcpu)
- {
-- return vcpu->arch.exception.pending &&
-- vcpu->arch.exception.nr == DB_VECTOR &&
-- vcpu->arch.exception.payload;
-+ if (!vcpu->arch.exception.pending ||
-+ vcpu->arch.exception.nr != DB_VECTOR)
-+ return 0;
-+
-+ /* General Detect #DBs are always fault-like. */
-+ return vcpu->arch.exception.payload & ~DR6_BD;
- }
-
- /*
-@@ -3873,9 +3886,10 @@ static inline bool vmx_pending_dbg_trap(struct kvm_vcpu *vcpu)
- */
- static void nested_vmx_update_pending_dbg(struct kvm_vcpu *vcpu)
- {
-- if (vmx_pending_dbg_trap(vcpu))
-- vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
-- vcpu->arch.exception.payload);
-+ unsigned long pending_dbg = vmx_get_pending_dbg_trap(vcpu);
-+
-+ if (pending_dbg)
-+ vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, pending_dbg);
- }
-
- static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu)
-@@ -3932,7 +3946,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- * while delivering the pending exception.
- */
-
-- if (vcpu->arch.exception.pending && !vmx_pending_dbg_trap(vcpu)) {
-+ if (vcpu->arch.exception.pending && !vmx_get_pending_dbg_trap(vcpu)) {
- if (vmx->nested.nested_run_pending)
- return -EBUSY;
- if (!nested_vmx_check_exception(vcpu, &exit_qual))
---
-2.35.1
-
+++ /dev/null
-From 51bde6bcdd0364a3924d8b07b3036199f0482059 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:58 +0000
-Subject: KVM: nVMX: Unconditionally clear mtf_pending on nested VM-Exit
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit 593a5c2e3c12a2f65967739267093255c47e9fe0 ]
-
-Clear mtf_pending on nested VM-Exit instead of handling the clear on a
-case-by-case basis in vmx_check_nested_events(). The pending MTF should
-never survive nested VM-Exit, as it is a property of KVM's run of the
-current L2, i.e. should never affect the next L2 run by L1. In practice,
-this is likely a nop as getting to L1 with nested_run_pending is
-impossible, and KVM doesn't correctly handle morphing a pending exception
-that occurs on a prior injected exception (need for re-injected exception
-being the other case where MTF isn't cleared). However, KVM will
-hopefully soon correctly deal with a pending exception on top of an
-injected exception.
-
-Add a TODO to document that KVM has an inversion priority bug between
-SMIs and MTF (and trap-like #DBS), and that KVM also doesn't properly
-save/restore MTF across SMI/RSM.
-
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-12-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Stable-dep-of: 7709aba8f716 ("KVM: x86: Morph pending exceptions to pending VM-Exits at queue time")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/nested.c | 21 ++++++++++++---------
- 1 file changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
-index 94b4b3d306ce..e9b1447faacd 100644
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3904,16 +3904,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- unsigned long exit_qual;
- bool block_nested_events =
- vmx->nested.nested_run_pending || kvm_event_needs_reinjection(vcpu);
-- bool mtf_pending = vmx->nested.mtf_pending;
- struct kvm_lapic *apic = vcpu->arch.apic;
-
-- /*
-- * Clear the MTF state. If a higher priority VM-exit is delivered first,
-- * this state is discarded.
-- */
-- if (!block_nested_events)
-- vmx->nested.mtf_pending = false;
--
- if (lapic_in_kernel(vcpu) &&
- test_bit(KVM_APIC_INIT, &apic->pending_events)) {
- if (block_nested_events)
-@@ -3922,6 +3914,9 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- clear_bit(KVM_APIC_INIT, &apic->pending_events);
- if (vcpu->arch.mp_state != KVM_MP_STATE_INIT_RECEIVED)
- nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0);
-+
-+ /* MTF is discarded if the vCPU is in WFS. */
-+ vmx->nested.mtf_pending = false;
- return 0;
- }
-
-@@ -3944,6 +3939,11 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- * fault-like exceptions, TSS T flag #DB (not emulated by KVM, but
- * could theoretically come in from userspace), and ICEBP (INT1).
- *
-+ * TODO: SMIs have higher priority than MTF and trap-like #DBs (except
-+ * for TSS T flag #DBs). KVM also doesn't save/restore pending MTF
-+ * across SMI/RSM as it should; that needs to be addressed in order to
-+ * prioritize SMI over MTF and trap-like #DBs.
-+ *
- * Note that only a pending nested run can block a pending exception.
- * Otherwise an injected NMI/interrupt should either be
- * lost or delivered to the nested hypervisor in the IDT_VECTORING_INFO,
-@@ -3959,7 +3959,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
- return 0;
- }
-
-- if (mtf_pending) {
-+ if (vmx->nested.mtf_pending) {
- if (block_nested_events)
- return -EBUSY;
- nested_vmx_update_pending_dbg(vcpu);
-@@ -4558,6 +4558,9 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
- struct vcpu_vmx *vmx = to_vmx(vcpu);
- struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
-
-+ /* Pending MTF traps are discarded on VM-Exit. */
-+ vmx->nested.mtf_pending = false;
-+
- /* trying to cancel vmlaunch/vmresume is a bug */
- WARN_ON_ONCE(vmx->nested.nested_run_pending);
-
---
-2.35.1
-
+++ /dev/null
-From 01c5c8919a68ca331ff3b80f161bfc28c321c8c0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 23:15:59 +0000
-Subject: KVM: VMX: Inject #PF on ENCLS as "emulated" #PF
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit bfcb08a0b9e99b959814a329fabace22c3df046d ]
-
-Treat #PFs that occur during emulation of ENCLS as, wait for it, emulated
-page faults. Practically speaking, this is a glorified nop as the
-exception is never of the nested flavor, and it's extremely unlikely the
-guest is relying on the side effect of an implicit INVLPG on the faulting
-address.
-
-Fixes: 70210c044b4e ("KVM: VMX: Add SGX ENCLS[ECREATE] handler to enforce CPUID restrictions")
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
-Link: https://lore.kernel.org/r/20220830231614.3580124-13-seanjc@google.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/vmx/sgx.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/x86/kvm/vmx/sgx.c b/arch/x86/kvm/vmx/sgx.c
-index 6693ebdc0770..ebe6e21cad24 100644
---- a/arch/x86/kvm/vmx/sgx.c
-+++ b/arch/x86/kvm/vmx/sgx.c
-@@ -133,7 +133,7 @@ static int sgx_inject_fault(struct kvm_vcpu *vcpu, gva_t gva, int trapnr)
- ex.address = gva;
- ex.error_code_valid = true;
- ex.nested_page_fault = false;
-- kvm_inject_page_fault(vcpu, &ex);
-+ kvm_inject_emulated_page_fault(vcpu, &ex);
- } else {
- kvm_inject_gp(vcpu, 0);
- }
---
-2.35.1
-
+++ /dev/null
-From 1bd4e2dd2308823eb419528af6ff7ef407a9fcd5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Aug 2022 15:37:08 +0200
-Subject: KVM: x86: Check for existing Hyper-V vCPU in kvm_hv_vcpu_init()
-
-From: Sean Christopherson <seanjc@google.com>
-
-[ Upstream commit 1cac8d9f6bd25df3713103e44e2d9ca0c2e03c33 ]
-
-When potentially allocating/initializing the Hyper-V vCPU struct, check
-for an existing instance in kvm_hv_vcpu_init() instead of requiring
-callers to perform the check. Relying on callers to do the check is
-risky as it's all too easy for KVM to overwrite vcpu->arch.hyperv and
-leak memory, and it adds additional burden on callers without much
-benefit.
-
-No functional change intended.
-
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Reviewed-by: Wei Liu <wei.liu@kernel.org>
-Link: https://lore.kernel.org/r/20220830133737.1539624-5-vkuznets@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Stable-dep-of: 3be29eb7b525 ("KVM: x86: Report error when setting CPUID if Hyper-V allocation fails")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/hyperv.c | 27 ++++++++++++---------------
- 1 file changed, 12 insertions(+), 15 deletions(-)
-
-diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
-index 762b43f0d919..fccc2abddd75 100644
---- a/arch/x86/kvm/hyperv.c
-+++ b/arch/x86/kvm/hyperv.c
-@@ -929,9 +929,12 @@ static void stimer_init(struct kvm_vcpu_hv_stimer *stimer, int timer_index)
-
- static int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu)
- {
-- struct kvm_vcpu_hv *hv_vcpu;
-+ struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu);
- int i;
-
-+ if (hv_vcpu)
-+ return 0;
-+
- hv_vcpu = kzalloc(sizeof(struct kvm_vcpu_hv), GFP_KERNEL_ACCOUNT);
- if (!hv_vcpu)
- return -ENOMEM;
-@@ -955,11 +958,9 @@ int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages)
- struct kvm_vcpu_hv_synic *synic;
- int r;
-
-- if (!to_hv_vcpu(vcpu)) {
-- r = kvm_hv_vcpu_init(vcpu);
-- if (r)
-- return r;
-- }
-+ r = kvm_hv_vcpu_init(vcpu);
-+ if (r)
-+ return r;
-
- synic = to_hv_synic(vcpu);
-
-@@ -1677,10 +1678,8 @@ int kvm_hv_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data, bool host)
- if (!host && !vcpu->arch.hyperv_enabled)
- return 1;
-
-- if (!to_hv_vcpu(vcpu)) {
-- if (kvm_hv_vcpu_init(vcpu))
-- return 1;
-- }
-+ if (kvm_hv_vcpu_init(vcpu))
-+ return 1;
-
- if (kvm_hv_msr_partition_wide(msr)) {
- int r;
-@@ -1700,10 +1699,8 @@ int kvm_hv_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata, bool host)
- if (!host && !vcpu->arch.hyperv_enabled)
- return 1;
-
-- if (!to_hv_vcpu(vcpu)) {
-- if (kvm_hv_vcpu_init(vcpu))
-- return 1;
-- }
-+ if (kvm_hv_vcpu_init(vcpu))
-+ return 1;
-
- if (kvm_hv_msr_partition_wide(msr)) {
- int r;
-@@ -1992,7 +1989,7 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu)
- return;
- }
-
-- if (!to_hv_vcpu(vcpu) && kvm_hv_vcpu_init(vcpu))
-+ if (kvm_hv_vcpu_init(vcpu))
- return;
-
- hv_vcpu = to_hv_vcpu(vcpu);
---
-2.35.1
-
+++ /dev/null
-From 8571e283c27ecb4b6270781434f9bdc9e736a5b4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Aug 2022 14:32:37 +0800
-Subject: KVM: x86/mmu: fix memoryleak in kvm_mmu_vendor_module_init()
-
-From: Miaohe Lin <linmiaohe@huawei.com>
-
-[ Upstream commit d7c9bfb9caaffd496ae44b258ec7c793677d3eeb ]
-
-When register_shrinker() fails, KVM doesn't release the percpu counter
-kvm_total_used_mmu_pages leading to memoryleak. Fix this issue by calling
-percpu_counter_destroy() when register_shrinker() fails.
-
-Fixes: ab271bd4dfd5 ("x86: kvm: propagate register_shrinker return code")
-Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
-Link: https://lore.kernel.org/r/20220823063237.47299-1-linmiaohe@huawei.com
-[sean: tweak shortlog and changelog]
-Signed-off-by: Sean Christopherson <seanjc@google.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/kvm/mmu/mmu.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
-index ba1749a770eb..23839c90f44c 100644
---- a/arch/x86/kvm/mmu/mmu.c
-+++ b/arch/x86/kvm/mmu/mmu.c
-@@ -6147,10 +6147,12 @@ int kvm_mmu_vendor_module_init(void)
-
- ret = register_shrinker(&mmu_shrinker);
- if (ret)
-- goto out;
-+ goto out_shrinker;
-
- return 0;
-
-+out_shrinker:
-+ percpu_counter_destroy(&kvm_total_used_mmu_pages);
- out:
- mmu_destroy_caches();
- return ret;
---
-2.35.1
-
mailbox-mpfs-fix-handling-of-the-reg-property.patch
mailbox-mpfs-account-for-mbox-offsets-while-sending.patch
mailbox-bcm-ferxrm-mailbox-fix-error-check-for-dma_m.patch
-kvm-x86-mmu-fix-memoryleak-in-kvm_mmu_vendor_module_.patch
powerpc-configs-properly-enable-papr_scm-in-pseries_.patch
powerpc-math_emu-efp-include-module.h.patch
powerpc-sysdev-fsl_msi-add-missing-of_node_put.patch
powerpc-powernv-add-missing-of_node_put-in-opal_expo.patch
powerpc-fix-fallocate-and-fadvise64_64-compat-parame.patch
x86-hyperv-fix-struct-hv_enlightened_vmcs-definition.patch
-kvm-x86-check-for-existing-hyper-v-vcpu-in-kvm_hv_vc.patch
-kvm-nvmx-treat-general-detect-db-dr7.gd-1-as-fault-l.patch
-kvm-nvmx-prioritize-tss-t-flag-dbs-over-monitor-trap.patch
-kvm-nvmx-ignore-sipi-that-arrives-in-l2-when-vcpu-is.patch
-kvm-vmx-inject-pf-on-encls-as-emulated-pf.patch
-kvm-nvmx-unconditionally-clear-mtf_pending-on-nested.patch
powerpc-64s-fix-generic_cpu-build-flags-for-ppc970-g.patch
powerpc-fix-spe-power-isa-properties-for-e500v1-plat.patch
powerpc-kprobes-fix-null-pointer-reference-in-arch_p.patch
crypto-hisilicon-zip-fix-mismatch-in-get-set-sgl_sge.patch
hwrng-arm-smccc-trng-fix-no_entropy-handling.patch
cgroup-honor-caller-s-cgroup-ns-when-resolving-path.patch
-clk-generalize-devm_clk_get-a-bit.patch
-clk-provide-new-devm_clk-helpers-for-prepared-and-en.patch
-hwrng-imx-rngc-use-devm_clk_get_enabled.patch
hwrng-imx-rngc-moving-irq-handler-registering-after-.patch
crypto-qat-fix-default-value-of-wdt-timer.patch
crypto-hisilicon-qm-fix-missing-put-dfx-access.patch
acpi-apei-do-not-add-task_work-to-kernel-thread-to-a.patch
f2fs-fix-race-condition-on-setting-fi_no_extent-flag.patch
f2fs-fix-to-account-fs_cp_data_io-correctly.patch
-tools-power-turbostat-separate-spr-from-icx.patch
-tools-power-turbostat-use-standard-energy-unit-for-s.patch
selftest-tpm2-add-client.__del__-to-close-dev-tpm-ha.patch
fs-dlm-fix-race-in-lowcomms.patch
rcu-avoid-triggering-strict-gp-irq-work-when-rcu-is-.patch
revert-net-ieee802154-reject-zero-sized-raw_sendmsg.patch
net-ieee802154-don-t-warn-zero-sized-raw_sendmsg.patch
drm-amd-display-fix-build-breakage-with-config_debug_fs-n.patch
-clk-fix-pointer-casting-to-prevent-oops-in-devm_clk_release.patch
net-wwan-t7xx-use-gfp_atomic-under-spin-lock-in-t7xx_cldma_gpd_set_next_ptr.patch
kconfig.debug-simplify-the-dependency-of-debug_info_dwarf4-5.patch
kconfig.debug-add-toolchain-checks-for-debug_info_dwarf_toolchain_default.patch
+++ /dev/null
-From 10436a0553b019ff0cc7d81a8b601bd5b7fdd7e8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Jul 2022 18:29:32 +0300
-Subject: tools/power turbostat: separate SPR from ICX
-
-From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-
-[ Upstream commit 684e40e99e594e0da1dc1b358fbd51c03c606e75 ]
-
-Before this patch, SPR platform was considered identical to ICX platform. This
-patch separates SPR support from ICX.
-
-This patch is a preparation for adding SPR-specific package C-state limits
-support.
-
-Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-Reviewed-by: Chen Yu <yu.c.chen@intel.com>
-Signed-off-by: Len Brown <len.brown@intel.com>
-Stable-dep-of: b2d433ae6376 ("tools/power turbostat: Use standard Energy Unit for SPR Dram RAPL domain")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/power/x86/turbostat/turbostat.c | 31 ++++++++++++++++++++++-----
- 1 file changed, 26 insertions(+), 5 deletions(-)
-
-diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
-index 4f176bbf29f4..2a185a7c993c 100644
---- a/tools/power/x86/turbostat/turbostat.c
-+++ b/tools/power/x86/turbostat/turbostat.c
-@@ -2432,6 +2432,7 @@ int has_turbo_ratio_group_limits(int family, int model)
- case INTEL_FAM6_ATOM_GOLDMONT:
- case INTEL_FAM6_SKYLAKE_X:
- case INTEL_FAM6_ICELAKE_X:
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X:
- case INTEL_FAM6_ATOM_GOLDMONT_D:
- case INTEL_FAM6_ATOM_TREMONT_D:
- return 1;
-@@ -3673,6 +3674,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
- has_misc_feature_control = 1;
- break;
- case INTEL_FAM6_ICELAKE_X: /* ICX */
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- pkg_cstate_limits = icx_pkg_cstate_limits;
- has_misc_feature_control = 1;
- break;
-@@ -3782,6 +3784,22 @@ int is_icx(unsigned int family, unsigned int model)
- return 0;
- }
-
-+int is_spr(unsigned int family, unsigned int model)
-+{
-+
-+ if (!genuine_intel)
-+ return 0;
-+
-+ if (family != 6)
-+ return 0;
-+
-+ switch (model) {
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X:
-+ return 1;
-+ }
-+ return 0;
-+}
-+
- int is_ehl(unsigned int family, unsigned int model)
- {
- if (!genuine_intel)
-@@ -3890,6 +3908,7 @@ int has_glm_turbo_ratio_limit(unsigned int family, unsigned int model)
- case INTEL_FAM6_ATOM_GOLDMONT:
- case INTEL_FAM6_SKYLAKE_X:
- case INTEL_FAM6_ICELAKE_X:
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X:
- return 1;
- default:
- return 0;
-@@ -3917,7 +3936,7 @@ int has_config_tdp(unsigned int family, unsigned int model)
- case INTEL_FAM6_CANNONLAKE_L: /* CNL */
- case INTEL_FAM6_SKYLAKE_X: /* SKX */
- case INTEL_FAM6_ICELAKE_X: /* ICX */
--
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- case INTEL_FAM6_XEON_PHI_KNL: /* Knights Landing */
- return 1;
- default:
-@@ -4377,6 +4396,7 @@ static double rapl_dram_energy_units_probe(int model, double rapl_energy_units)
- case INTEL_FAM6_SKYLAKE_X: /* SKX */
- case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
- case INTEL_FAM6_ICELAKE_X: /* ICX */
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- return (rapl_dram_energy_units = 15.3 / 1000000);
- default:
- return (rapl_energy_units);
-@@ -4466,6 +4486,7 @@ void rapl_probe_intel(unsigned int family, unsigned int model)
- case INTEL_FAM6_BROADWELL_X: /* BDX */
- case INTEL_FAM6_SKYLAKE_X: /* SKX */
- case INTEL_FAM6_ICELAKE_X: /* ICX */
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
- do_rapl =
- RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS |
-@@ -4628,13 +4649,13 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model)
-
- void automatic_cstate_conversion_probe(unsigned int family, unsigned int model)
- {
-- if (is_skx(family, model) || is_bdx(family, model) || is_icx(family, model))
-+ if (is_skx(family, model) || is_bdx(family, model) || is_icx(family, model) || is_spr(family, model))
- has_automatic_cstate_conversion = 1;
- }
-
- void prewake_cstate_probe(unsigned int family, unsigned int model)
- {
-- if (is_icx(family, model))
-+ if (is_icx(family, model) || is_spr(family, model))
- dis_cstate_prewake = 1;
- }
-
-@@ -4847,6 +4868,7 @@ int has_snb_msrs(unsigned int family, unsigned int model)
- case INTEL_FAM6_CANNONLAKE_L: /* CNL */
- case INTEL_FAM6_SKYLAKE_X: /* SKX */
- case INTEL_FAM6_ICELAKE_X: /* ICX */
-+ case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
- case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
- case INTEL_FAM6_ATOM_GOLDMONT_D: /* DNV */
-@@ -5216,7 +5238,6 @@ unsigned int intel_model_duplicates(unsigned int model)
- return INTEL_FAM6_ATOM_TREMONT;
-
- case INTEL_FAM6_ICELAKE_D:
-- case INTEL_FAM6_SAPPHIRERAPIDS_X:
- return INTEL_FAM6_ICELAKE_X;
- }
- return model;
-@@ -5503,7 +5524,7 @@ void process_cpuid()
- BIC_NOT_PRESENT(BIC_Pkgpc7);
- use_c1_residency_msr = 1;
- }
-- if (is_skx(family, model) || is_icx(family, model)) {
-+ if (is_skx(family, model) || is_icx(family, model) || is_spr(family, model)) {
- BIC_NOT_PRESENT(BIC_CPU_c3);
- BIC_NOT_PRESENT(BIC_Pkgpc3);
- BIC_NOT_PRESENT(BIC_CPU_c7);
---
-2.35.1
-
+++ /dev/null
-From dfe2b3a971e504495ff5a28fbf4195af1b3977f8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 24 Sep 2022 13:47:38 +0800
-Subject: tools/power turbostat: Use standard Energy Unit for SPR Dram RAPL
- domain
-
-From: Zhang Rui <rui.zhang@intel.com>
-
-[ Upstream commit b2d433ae637626d44c9d4a75dd3330cf68fed9de ]
-
-Intel Xeon servers used to use a fixed energy resolution (15.3uj) for
-Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard
-energy resolution as described in MSR_RAPL_POWER_UNIT.
-
-Remove the SPR rapl_dram_energy_units quirk.
-
-Fixes: e7af1ed3fa47 ("tools/power turbostat: Support additional CPU model numbers")
-Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-Tested-by: Wang Wendy <wendy.wang@intel.com>
-Signed-off-by: Len Brown <len.brown@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/power/x86/turbostat/turbostat.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
-index 2a185a7c993c..6c1b02a754eb 100644
---- a/tools/power/x86/turbostat/turbostat.c
-+++ b/tools/power/x86/turbostat/turbostat.c
-@@ -4396,7 +4396,6 @@ static double rapl_dram_energy_units_probe(int model, double rapl_energy_units)
- case INTEL_FAM6_SKYLAKE_X: /* SKX */
- case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
- case INTEL_FAM6_ICELAKE_X: /* ICX */
-- case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
- return (rapl_dram_energy_units = 15.3 / 1000000);
- default:
- return (rapl_energy_units);
---
-2.35.1
-