From: Greg Kroah-Hartman Date: Fri, 21 Oct 2022 15:54:55 +0000 (+0200) Subject: drop more 5.19 patches X-Git-Tag: v5.19.17~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1db299844d71e368da93e27626e171922371090b;p=thirdparty%2Fkernel%2Fstable-queue.git drop more 5.19 patches --- diff --git a/queue-5.19/clk-fix-pointer-casting-to-prevent-oops-in-devm_clk_release.patch b/queue-5.19/clk-fix-pointer-casting-to-prevent-oops-in-devm_clk_release.patch deleted file mode 100644 index 744ee3e8e52..00000000000 --- a/queue-5.19/clk-fix-pointer-casting-to-prevent-oops-in-devm_clk_release.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 8b3d743fc9e2542822826890b482afabf0e7522a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= -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 - -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 -Fixes: abae8e57e49a ("clk: generalize devm_clk_get() a bit") -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20220620171815.114212-1-u.kleine-koenig@pengutronix.de -Tested-by: Marek Szyprowski -Tested-by: Linux Kernel Functional Testing -Signed-off-by: Stephen Boyd -Signed-off-by: Greg Kroah-Hartman ---- - 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); diff --git a/queue-5.19/clk-generalize-devm_clk_get-a-bit.patch b/queue-5.19/clk-generalize-devm_clk_get-a-bit.patch deleted file mode 100644 index 1b134e04755..00000000000 --- a/queue-5.19/clk-generalize-devm_clk_get-a-bit.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 93861fad9d3b7b1fedb6b378c95f14c1df2a25e5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Reviewed-by: Alexandru Ardelean -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20220520075737.758761-3-u.kleine-koenig@pengutronix.de -Signed-off-by: Stephen Boyd -Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()") -Signed-off-by: Sasha Levin ---- - 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 - #include - -+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 - diff --git a/queue-5.19/clk-provide-new-devm_clk-helpers-for-prepared-and-en.patch b/queue-5.19/clk-provide-new-devm_clk-helpers-for-prepared-and-en.patch deleted file mode 100644 index 05ace615530..00000000000 --- a/queue-5.19/clk-provide-new-devm_clk-helpers-for-prepared-and-en.patch +++ /dev/null @@ -1,214 +0,0 @@ -From 2c9243c9fc77edec150d7819b16a69d373d2193c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Reviewed-by: Alexandru Ardelean -Signed-off-by: Uwe Kleine-König -Link: https://lore.kernel.org/r/20220520075737.758761-4-u.kleine-koenig@pengutronix.de -Signed-off-by: Stephen Boyd -Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()") -Signed-off-by: Sasha Levin ---- - 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 39faa54efe88..d2394b1f4efe 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 - diff --git a/queue-5.19/dt-bindings-timer-add-nomadik-mtu-binding.patch b/queue-5.19/dt-bindings-timer-add-nomadik-mtu-binding.patch deleted file mode 100644 index 129279b8d06..00000000000 --- a/queue-5.19/dt-bindings-timer-add-nomadik-mtu-binding.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 165c5be60efde331323be294db5946a85efb27cc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 26 May 2022 23:36:21 +0200 -Subject: dt-bindings: timer: Add Nomadik MTU binding - -From: Linus Walleij - -[ Upstream commit d6513a34926f4f4b331be115819702ca2a4682fb ] - -The Nomadik MTU timer has been used in devicetrees forever -but somehow we missed to add a binding for it. Fix it -by simply adding it. - -Cc: Lee Jones -Cc: devicetree@vger.kernel.org -Signed-off-by: Linus Walleij -Reviewed-by: Rob Herring -Link: https://lore.kernel.org/r/20220526213621.373727-1-linus.walleij@linaro.org -Signed-off-by: Daniel Lezcano -Stable-dep-of: 6c3b62d93e19 ("clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921") -Signed-off-by: Sasha Levin ---- - .../bindings/timer/st,nomadik-mtu.yaml | 58 +++++++++++++++++++ - 1 file changed, 58 insertions(+) - create mode 100644 Documentation/devicetree/bindings/timer/st,nomadik-mtu.yaml - -diff --git a/Documentation/devicetree/bindings/timer/st,nomadik-mtu.yaml b/Documentation/devicetree/bindings/timer/st,nomadik-mtu.yaml -new file mode 100644 -index 000000000000..901848d298ec ---- /dev/null -+++ b/Documentation/devicetree/bindings/timer/st,nomadik-mtu.yaml -@@ -0,0 +1,58 @@ -+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) -+# Copyright 2022 Linaro Ltd. -+%YAML 1.2 -+--- -+$id: "http://devicetree.org/schemas/timer/st,nomadik-mtu.yaml#" -+$schema: "http://devicetree.org/meta-schemas/core.yaml#" -+ -+title: ST Microelectronics Nomadik Multi-Timer Unit MTU Timer -+ -+maintainers: -+ - Linus Walleij -+ -+description: This timer is found in the ST Microelectronics Nomadik -+ SoCs STn8800, STn8810 and STn8815 as well as in ST-Ericsson DB8500. -+ -+properties: -+ compatible: -+ items: -+ - const: st,nomadik-mtu -+ -+ reg: -+ maxItems: 1 -+ -+ interrupts: -+ maxItems: 1 -+ -+ clocks: -+ description: The first clock named TIMCLK clocks the actual timers and -+ the second clock clocks the digital interface to the interconnect. -+ maxItems: 2 -+ -+ clock-names: -+ items: -+ - const: timclk -+ - const: apb_pclk -+ -+required: -+ - compatible -+ - reg -+ - interrupts -+ - clocks -+ - clock-names -+ -+additionalProperties: false -+ -+examples: -+ - | -+ #include -+ #include -+ #include -+ timer@a03c6000 { -+ compatible = "st,nomadik-mtu"; -+ reg = <0xa03c6000 0x1000>; -+ interrupts = ; -+ -+ clocks = <&prcmu_clk PRCMU_TIMCLK>, <&prcc_pclk 6 6>; -+ clock-names = "timclk", "apb_pclk"; -+ }; --- -2.35.1 - diff --git a/queue-5.19/fs-don-t-randomize-struct-kiocb-fields.patch b/queue-5.19/fs-don-t-randomize-struct-kiocb-fields.patch deleted file mode 100644 index 433da52c1ea..00000000000 --- a/queue-5.19/fs-don-t-randomize-struct-kiocb-fields.patch +++ /dev/null @@ -1,49 +0,0 @@ -From f850583179b4c818114d5866487adf692a67077c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 12 Aug 2022 15:56:33 -0700 -Subject: fs: don't randomize struct kiocb fields - -From: Keith Busch - -[ Upstream commit addebd9ac9ca0ef8b3764907bf8018e48caffc64 ] - -This is a size sensitive structure and randomizing can introduce extra -padding that breaks io_uring's fixed size expectations. There are few -fields here as it is, half of which need a fixed order to optimally -pack, so the randomization isn't providing much. - -Suggested-by: Linus Torvalds -Signed-off-by: Keith Busch -Link: https://lore.kernel.org/io-uring/b6f508ca-b1b2-5f40-7998-e4cff1cf7212@kernel.dk/ -Signed-off-by: Jens Axboe -Stable-dep-of: b000145e9907 ("io_uring/rw: defer fsnotify calls to task context") -Signed-off-by: Sasha Levin ---- - include/linux/fs.h | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 21ed10a2e1cd..1e919b7420d1 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -318,17 +318,12 @@ enum rw_hint { - - struct kiocb { - struct file *ki_filp; -- -- /* The 'ki_filp' pointer is shared in a union for aio */ -- randomized_struct_fields_start -- - loff_t ki_pos; - void (*ki_complete)(struct kiocb *iocb, long ret); - void *private; - int ki_flags; - u16 ki_ioprio; /* See linux/ioprio.h */ - struct wait_page_queue *ki_waitq; /* for async buffered IO */ -- randomized_struct_fields_end - }; - - static inline bool is_sync_kiocb(struct kiocb *kiocb) --- -2.35.1 - diff --git a/queue-5.19/hwrng-imx-rngc-moving-irq-handler-registering-after-.patch b/queue-5.19/hwrng-imx-rngc-moving-irq-handler-registering-after-.patch index 393976c0707..2dfcc611eec 100644 --- a/queue-5.19/hwrng-imx-rngc-moving-irq-handler-registering-after-.patch +++ b/queue-5.19/hwrng-imx-rngc-moving-irq-handler-registering-after-.patch @@ -21,28 +21,26 @@ Signed-off-by: Kshitiz Varshney Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- - 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); @@ -56,6 +54,3 @@ index e32c52c10d4d..1d7ce7443586 100644 if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) { --- -2.35.1 - diff --git a/queue-5.19/hwrng-imx-rngc-use-devm_clk_get_enabled.patch b/queue-5.19/hwrng-imx-rngc-use-devm_clk_get_enabled.patch deleted file mode 100644 index 75d5aefcf69..00000000000 --- a/queue-5.19/hwrng-imx-rngc-use-devm_clk_get_enabled.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 1e26bece8e6111830df4efb829632bee9f4eab77 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 15 Aug 2022 21:37:42 +0200 -Subject: hwrng: imx-rngc - use devm_clk_get_enabled - -From: Martin Kaiser - -[ 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 -Signed-off-by: Herbert Xu -Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()") -Signed-off-by: Sasha Levin ---- - 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 - diff --git a/queue-5.19/kvm-fix-memoryleak-in-kvm_init.patch b/queue-5.19/kvm-fix-memoryleak-in-kvm_init.patch deleted file mode 100644 index b55f3eb11be..00000000000 --- a/queue-5.19/kvm-fix-memoryleak-in-kvm_init.patch +++ /dev/null @@ -1,51 +0,0 @@ -From e7c08126135755d19a80390659f07d911eb6b9ce Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 23 Aug 2022 14:34:14 +0800 -Subject: KVM: fix memoryleak in kvm_init() - -From: Miaohe Lin - -[ Upstream commit 5a2a961be2ad6a16eb388a80442443b353c11d16 ] - -When alloc_cpumask_var_node() fails for a certain cpu, there might be some -allocated cpumasks for percpu cpu_kick_mask. We should free these cpumasks -or memoryleak will occur. - -Fixes: baff59ccdc65 ("KVM: Pre-allocate cpumasks for kvm_make_all_cpus_request_except()") -Signed-off-by: Miaohe Lin -Link: https://lore.kernel.org/r/20220823063414.59778-1-linmiaohe@huawei.com -Signed-off-by: Sean Christopherson -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - virt/kvm/kvm_main.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index c56861ed0e38..4afa94f55d7e 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -5783,7 +5783,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, - - r = kvm_async_pf_init(); - if (r) -- goto out_free_5; -+ goto out_free_4; - - kvm_chardev_ops.owner = module; - -@@ -5807,10 +5807,9 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, - - out_unreg: - kvm_async_pf_deinit(); --out_free_5: -+out_free_4: - for_each_possible_cpu(cpu) - free_cpumask_var(per_cpu(cpu_kick_mask, cpu)); --out_free_4: - kmem_cache_destroy(kvm_vcpu_cache); - out_free_3: - unregister_reboot_notifier(&kvm_reboot_notifier); --- -2.35.1 - diff --git a/queue-5.19/kvm-nvmx-ignore-sipi-that-arrives-in-l2-when-vcpu-is.patch b/queue-5.19/kvm-nvmx-ignore-sipi-that-arrives-in-l2-when-vcpu-is.patch deleted file mode 100644 index f1d3f0aa75f..00000000000 --- a/queue-5.19/kvm-nvmx-ignore-sipi-that-arrives-in-l2-when-vcpu-is.patch +++ /dev/null @@ -1,47 +0,0 @@ -From f0fb08f9b370a8b01dde14a520c007b0adbacff4 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Reviewed-by: Maxim Levitsky -Link: https://lore.kernel.org/r/20220830231614.3580124-11-seanjc@google.com -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - 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 3bf00684f6cc..fdf31c7f61e5 100644 ---- a/arch/x86/kvm/vmx/nested.c -+++ b/arch/x86/kvm/vmx/nested.c -@@ -3944,10 +3944,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 - diff --git a/queue-5.19/kvm-nvmx-prioritize-tss-t-flag-dbs-over-monitor-trap.patch b/queue-5.19/kvm-nvmx-prioritize-tss-t-flag-dbs-over-monitor-trap.patch deleted file mode 100644 index beee8e1d82a..00000000000 --- a/queue-5.19/kvm-nvmx-prioritize-tss-t-flag-dbs-over-monitor-trap.patch +++ /dev/null @@ -1,58 +0,0 @@ -From a9eb67021e41d9cfe3c92a21906c40d55d0c546d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 30 Aug 2022 23:15:54 +0000 -Subject: KVM: nVMX: Prioritize TSS T-flag #DBs over Monitor Trap Flag - -From: Sean Christopherson - -[ 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 -Cc: Peter Shier -Fixes: 5ef8acbdd687 ("KVM: nVMX: Emulate MTF when performing instruction emulation") -Signed-off-by: Sean Christopherson -Reviewed-by: Maxim Levitsky -Link: https://lore.kernel.org/r/20220830231614.3580124-8-seanjc@google.com -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - 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 c669a892e386..3bf00684f6cc 100644 ---- a/arch/x86/kvm/vmx/nested.c -+++ b/arch/x86/kvm/vmx/nested.c -@@ -3951,15 +3951,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 - diff --git a/queue-5.19/kvm-nvmx-treat-general-detect-db-dr7.gd-1-as-fault-l.patch b/queue-5.19/kvm-nvmx-treat-general-detect-db-dr7.gd-1-as-fault-l.patch deleted file mode 100644 index c11f60ab0da..00000000000 --- a/queue-5.19/kvm-nvmx-treat-general-detect-db-dr7.gd-1-as-fault-l.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 0366dd2c26cb455888fdbe1332c30b100c4d2972 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Cc: Peter Shier -Fixes: 684c0422da71 ("KVM: nVMX: Handle pending #DB when injecting INIT VM-exit") -Signed-off-by: Sean Christopherson -Reviewed-by: Maxim Levitsky -Link: https://lore.kernel.org/r/20220830231614.3580124-7-seanjc@google.com -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - 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 b98b8cede264..c669a892e386 100644 ---- a/arch/x86/kvm/vmx/nested.c -+++ b/arch/x86/kvm/vmx/nested.c -@@ -3865,16 +3865,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; - } - - /* -@@ -3886,9 +3899,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) -@@ -3945,7 +3959,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 - diff --git a/queue-5.19/kvm-nvmx-unconditionally-clear-mtf_pending-on-nested.patch b/queue-5.19/kvm-nvmx-unconditionally-clear-mtf_pending-on-nested.patch deleted file mode 100644 index 08e2d27b6e9..00000000000 --- a/queue-5.19/kvm-nvmx-unconditionally-clear-mtf_pending-on-nested.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 9ea6c2253e8ab6eade6c4ed6a411f4004c7630d9 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 30 Aug 2022 23:15:58 +0000 -Subject: KVM: nVMX: Unconditionally clear mtf_pending on nested VM-Exit - -From: Sean Christopherson - -[ 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 -Reviewed-by: Maxim Levitsky -Link: https://lore.kernel.org/r/20220830231614.3580124-12-seanjc@google.com -Signed-off-by: Paolo Bonzini -Stable-dep-of: 7709aba8f716 ("KVM: x86: Morph pending exceptions to pending VM-Exits at queue time") -Signed-off-by: Sasha Levin ---- - 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 fdf31c7f61e5..deed076c7e2d 100644 ---- a/arch/x86/kvm/vmx/nested.c -+++ b/arch/x86/kvm/vmx/nested.c -@@ -3917,16 +3917,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) -@@ -3935,6 +3927,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; - } - -@@ -3957,6 +3952,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, -@@ -3972,7 +3972,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); -@@ -4571,6 +4571,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 - diff --git a/queue-5.19/kvm-ppc-book3s-hv-fix-decrementer-migration.patch b/queue-5.19/kvm-ppc-book3s-hv-fix-decrementer-migration.patch deleted file mode 100644 index 6e3490e3a3b..00000000000 --- a/queue-5.19/kvm-ppc-book3s-hv-fix-decrementer-migration.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 6c2e077ec0af1ba4a510348435f126f38d89c356 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 16 Aug 2022 19:25:17 -0300 -Subject: KVM: PPC: Book3S HV: Fix decrementer migration - -From: Fabiano Rosas - -[ Upstream commit 0a5bfb824a6ea35e54b7e5ac6f881beea5e309d2 ] - -We used to have a workaround[1] for a hang during migration that was -made ineffective when we converted the decrementer expiry to be -relative to guest timebase. - -The point of the workaround was that in the absence of an explicit -decrementer expiry value provided by userspace during migration, KVM -needs to initialize dec_expires to a value that will result in an -expired decrementer after subtracting the current guest timebase. That -stops the vcpu from hanging after migration due to a decrementer -that's too large. - -If the dec_expires is now relative to guest timebase, its -initialization needs to be guest timebase-relative as well, otherwise -we end up with a decrementer expiry that is still larger than the -guest timebase. - -1- https://git.kernel.org/torvalds/c/5855564c8ab2 - -Fixes: 3c1a4322bba7 ("KVM: PPC: Book3S HV: Change dec_expires to be relative to guest timebase") -Signed-off-by: Fabiano Rosas -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20220816222517.1916391-1-farosas@linux.ibm.com -Signed-off-by: Sasha Levin ---- - arch/powerpc/kvm/book3s_hv.c | 18 ++++++++++++++++-- - arch/powerpc/kvm/powerpc.c | 1 - - 2 files changed, 16 insertions(+), 3 deletions(-) - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index e08fb3124dca..fcec1b0982b7 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -2517,10 +2517,24 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, - r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len); - break; - case KVM_REG_PPC_TB_OFFSET: -+ { - /* round up to multiple of 2^24 */ -- vcpu->arch.vcore->tb_offset = -- ALIGN(set_reg_val(id, *val), 1UL << 24); -+ u64 tb_offset = ALIGN(set_reg_val(id, *val), 1UL << 24); -+ -+ /* -+ * Now that we know the timebase offset, update the -+ * decrementer expiry with a guest timebase value. If -+ * the userspace does not set DEC_EXPIRY, this ensures -+ * a migrated vcpu at least starts with an expired -+ * decrementer, which is better than a large one that -+ * causes a hang. -+ */ -+ if (!vcpu->arch.dec_expires && tb_offset) -+ vcpu->arch.dec_expires = get_tb() + tb_offset; -+ -+ vcpu->arch.vcore->tb_offset = tb_offset; - break; -+ } - case KVM_REG_PPC_LPCR: - kvmppc_set_lpcr(vcpu, set_reg_val(id, *val), true); - break; -diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c -index 191992fcb2c2..7152291775c6 100644 ---- a/arch/powerpc/kvm/powerpc.c -+++ b/arch/powerpc/kvm/powerpc.c -@@ -785,7 +785,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) - - hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); - vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; -- vcpu->arch.dec_expires = get_tb(); - - #ifdef CONFIG_KVM_EXIT_TIMING - mutex_init(&vcpu->arch.exit_timing_lock); --- -2.35.1 - diff --git a/queue-5.19/kvm-ppc-book3s-hv-p9-clear-vcpu-cpu-fields-before-en.patch b/queue-5.19/kvm-ppc-book3s-hv-p9-clear-vcpu-cpu-fields-before-en.patch deleted file mode 100644 index f0441c71ddd..00000000000 --- a/queue-5.19/kvm-ppc-book3s-hv-p9-clear-vcpu-cpu-fields-before-en.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 9ecb5f8faf8703fe5cdf5240383c65bba337d6c9 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 8 Sep 2022 23:25:41 +1000 -Subject: KVM: PPC: Book3S HV P9: Clear vcpu cpu fields before enabling host - irqs - -From: Nicholas Piggin - -[ Upstream commit bc91c04bfff7cdf676011b97bb21b2861d7b21c9 ] - -On guest entry, vcpu->cpu and vcpu->arch.thread_cpu are set after -disabling host irqs. On guest exit there is a window whre tick time -accounting briefly enables irqs before these fields are cleared. - -Move them up to ensure they are cleared before host irqs are run. -This is possibly not a problem, but is more symmetric and makes the -fields less surprising. - -Signed-off-by: Nicholas Piggin -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20220908132545.4085849-1-npiggin@gmail.com -Stable-dep-of: 1a5486b3c351 ("KVM: PPC: Book3S HV P9: Restore stolen time logging in dtl") -Signed-off-by: Sasha Levin ---- - arch/powerpc/kvm/book3s_hv.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index 6a17896f0b5c..8b7e6915cb2d 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -4616,6 +4616,9 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - - set_irq_happened(trap); - -+ vcpu->cpu = -1; -+ vcpu->arch.thread_cpu = -1; -+ - context_tracking_guest_exit(); - if (!vtime_accounting_enabled_this_cpu()) { - powerpc_local_irq_pmu_restore(flags); -@@ -4631,9 +4634,6 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - } - vtime_account_guest_exit(); - -- vcpu->cpu = -1; -- vcpu->arch.thread_cpu = -1; -- - powerpc_local_irq_pmu_restore(flags); - - preempt_enable(); --- -2.35.1 - diff --git a/queue-5.19/kvm-ppc-book3s-hv-p9-fix-irq-disabling-in-tick-accou.patch b/queue-5.19/kvm-ppc-book3s-hv-p9-fix-irq-disabling-in-tick-accou.patch deleted file mode 100644 index 9d4197af558..00000000000 --- a/queue-5.19/kvm-ppc-book3s-hv-p9-fix-irq-disabling-in-tick-accou.patch +++ /dev/null @@ -1,48 +0,0 @@ -From cc20831a4c4f82e1476b5ffff896ce9ca43dfb6f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 8 Sep 2022 23:25:42 +1000 -Subject: KVM: PPC: Book3S HV P9: Fix irq disabling in tick accounting - -From: Nicholas Piggin - -[ Upstream commit c953f7500b65f2b157d1eb468ca8b86328834cce ] - -kvmhv_run_single_vcpu() disables PMIs as well as Linux irqs, -however the tick time accounting code enables and disables irqs and -not PMIs within this region. By chance this might not actually cause -a bug, but it is clearly an incorrect use of the APIs. - -Fixes: 2251fbe76395e ("KVM: PPC: Book3S HV P9: Improve mtmsrd scheduling by delaying MSR[EE] disable") -Signed-off-by: Nicholas Piggin -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20220908132545.4085849-2-npiggin@gmail.com -Signed-off-by: Sasha Levin ---- - arch/powerpc/kvm/book3s_hv.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index fcec1b0982b7..6a17896f0b5c 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -4618,7 +4618,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - - context_tracking_guest_exit(); - if (!vtime_accounting_enabled_this_cpu()) { -- local_irq_enable(); -+ powerpc_local_irq_pmu_restore(flags); - /* - * Service IRQs here before vtime_account_guest_exit() so any - * ticks that occurred while running the guest are accounted to -@@ -4627,7 +4627,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - * interrupts here, which has the problem that it accounts - * interrupt processing overhead to the host. - */ -- local_irq_disable(); -+ powerpc_local_irq_pmu_save(flags); - } - vtime_account_guest_exit(); - --- -2.35.1 - diff --git a/queue-5.19/kvm-ppc-book3s-hv-p9-restore-stolen-time-logging-in-.patch b/queue-5.19/kvm-ppc-book3s-hv-p9-restore-stolen-time-logging-in-.patch deleted file mode 100644 index b858f4aebd1..00000000000 --- a/queue-5.19/kvm-ppc-book3s-hv-p9-restore-stolen-time-logging-in-.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 5d38ae700dbf0f9e10752c47f1d90561ff45a6d3 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 8 Sep 2022 23:25:44 +1000 -Subject: KVM: PPC: Book3S HV P9: Restore stolen time logging in dtl - -From: Nicholas Piggin - -[ Upstream commit 1a5486b3c3517aa1f608a10003ade4da122cb175 ] - -Stolen time logging in dtl was removed from the P9 path, so guests had -no stolen time accounting. Add it back in a simpler way that still -avoids locks and per-core accounting code. - -Fixes: ecb6a7207f92 ("KVM: PPC: Book3S HV P9: Remove most of the vcore logic") -Signed-off-by: Nicholas Piggin -Signed-off-by: Michael Ellerman -Link: https://lore.kernel.org/r/20220908132545.4085849-4-npiggin@gmail.com -Signed-off-by: Sasha Levin ---- - arch/powerpc/kvm/book3s_hv.c | 49 +++++++++++++++++++++++++++++++++--- - 1 file changed, 45 insertions(+), 4 deletions(-) - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index 8b7e6915cb2d..a6893e67315f 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -249,6 +249,7 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) - - /* - * We use the vcpu_load/put functions to measure stolen time. -+ * - * Stolen time is counted as time when either the vcpu is able to - * run as part of a virtual core, but the task running the vcore - * is preempted or sleeping, or when the vcpu needs something done -@@ -278,6 +279,12 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) - * lock. The stolen times are measured in units of timebase ticks. - * (Note that the != TB_NIL checks below are purely defensive; - * they should never fail.) -+ * -+ * The POWER9 path is simpler, one vcpu per virtual core so the -+ * former case does not exist. If a vcpu is preempted when it is -+ * BUSY_IN_HOST and not ceded or otherwise blocked, then accumulate -+ * the stolen cycles in busy_stolen. RUNNING is not a preemptible -+ * state in the P9 path. - */ - - static void kvmppc_core_start_stolen(struct kvmppc_vcore *vc, u64 tb) -@@ -311,8 +318,14 @@ static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu) - unsigned long flags; - u64 now; - -- if (cpu_has_feature(CPU_FTR_ARCH_300)) -+ if (cpu_has_feature(CPU_FTR_ARCH_300)) { -+ if (vcpu->arch.busy_preempt != TB_NIL) { -+ WARN_ON_ONCE(vcpu->arch.state != KVMPPC_VCPU_BUSY_IN_HOST); -+ vc->stolen_tb += mftb() - vcpu->arch.busy_preempt; -+ vcpu->arch.busy_preempt = TB_NIL; -+ } - return; -+ } - - now = mftb(); - -@@ -340,8 +353,21 @@ static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu) - unsigned long flags; - u64 now; - -- if (cpu_has_feature(CPU_FTR_ARCH_300)) -+ if (cpu_has_feature(CPU_FTR_ARCH_300)) { -+ /* -+ * In the P9 path, RUNNABLE is not preemptible -+ * (nor takes host interrupts) -+ */ -+ WARN_ON_ONCE(vcpu->arch.state == KVMPPC_VCPU_RUNNABLE); -+ /* -+ * Account stolen time when preempted while the vcpu task is -+ * running in the kernel (but not in qemu, which is INACTIVE). -+ */ -+ if (task_is_running(current) && -+ vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST) -+ vcpu->arch.busy_preempt = mftb(); - return; -+ } - - now = mftb(); - -@@ -740,6 +766,18 @@ static void __kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu, - vcpu->arch.dtl.dirty = true; - } - -+static void kvmppc_create_dtl_entry_p9(struct kvm_vcpu *vcpu, -+ struct kvmppc_vcore *vc, -+ u64 now) -+{ -+ unsigned long stolen; -+ -+ stolen = vc->stolen_tb - vcpu->arch.stolen_logged; -+ vcpu->arch.stolen_logged = vc->stolen_tb; -+ -+ __kvmppc_create_dtl_entry(vcpu, vc->pcpu, now, stolen); -+} -+ - static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu, - struct kvmppc_vcore *vc) - { -@@ -4521,7 +4559,6 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - vc = vcpu->arch.vcore; - vcpu->arch.ceded = 0; - vcpu->arch.run_task = current; -- vcpu->arch.state = KVMPPC_VCPU_RUNNABLE; - vcpu->arch.last_inst = KVM_INST_FETCH_FAILED; - - /* See if the MMU is ready to go */ -@@ -4548,6 +4585,8 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - /* flags save not required, but irq_pmu has no disable/enable API */ - powerpc_local_irq_pmu_save(flags); - -+ vcpu->arch.state = KVMPPC_VCPU_RUNNABLE; -+ - if (signal_pending(current)) - goto sigpend; - if (need_resched() || !kvm->arch.mmu_ready) -@@ -4592,7 +4631,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - - tb = mftb(); - -- __kvmppc_create_dtl_entry(vcpu, pcpu, tb + vc->tb_offset, 0); -+ kvmppc_create_dtl_entry_p9(vcpu, vc, tb + vc->tb_offset); - - trace_kvm_guest_enter(vcpu); - -@@ -4618,6 +4657,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - - vcpu->cpu = -1; - vcpu->arch.thread_cpu = -1; -+ vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; - - context_tracking_guest_exit(); - if (!vtime_accounting_enabled_this_cpu()) { -@@ -4695,6 +4735,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, - out: - vcpu->cpu = -1; - vcpu->arch.thread_cpu = -1; -+ vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; - powerpc_local_irq_pmu_restore(flags); - preempt_enable(); - goto done; --- -2.35.1 - diff --git a/queue-5.19/kvm-vmx-inject-pf-on-encls-as-emulated-pf.patch b/queue-5.19/kvm-vmx-inject-pf-on-encls-as-emulated-pf.patch deleted file mode 100644 index 9c91441f0ed..00000000000 --- a/queue-5.19/kvm-vmx-inject-pf-on-encls-as-emulated-pf.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4fe019fe7893139a13d889d1b7e47c16bdad6944 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 30 Aug 2022 23:15:59 +0000 -Subject: KVM: VMX: Inject #PF on ENCLS as "emulated" #PF - -From: Sean Christopherson - -[ 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 -Reviewed-by: Maxim Levitsky -Link: https://lore.kernel.org/r/20220830231614.3580124-13-seanjc@google.com -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - 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 d1cc7244bede..6ea06dff5000 100644 ---- a/arch/x86/kvm/vmx/sgx.c -+++ b/arch/x86/kvm/vmx/sgx.c -@@ -129,7 +129,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 - diff --git a/queue-5.19/kvm-x86-add-dedicated-helper-to-get-cpuid-entry-with.patch b/queue-5.19/kvm-x86-add-dedicated-helper-to-get-cpuid-entry-with.patch deleted file mode 100644 index f825e83352e..00000000000 --- a/queue-5.19/kvm-x86-add-dedicated-helper-to-get-cpuid-entry-with.patch +++ /dev/null @@ -1,461 +0,0 @@ -From ccd062539a30ac0fec3f59438aaf8715b11e280d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 12 Jul 2022 02:06:45 +0200 -Subject: KVM: x86: Add dedicated helper to get CPUID entry with significant - index - -From: Sean Christopherson - -[ Upstream commit 277ad7d58611b455662f2e3f7bd24ce5bfeb2fdc ] - -Add a second CPUID helper, kvm_find_cpuid_entry_index(), to handle KVM -queries for CPUID leaves whose index _may_ be significant, and drop the -index param from the existing kvm_find_cpuid_entry(). Add a WARN in the -inner helper, cpuid_entry2_find(), to detect attempts to retrieve a CPUID -entry whose index is significant without explicitly providing an index. - -Using an explicit magic number and letting callers omit the index avoids -confusion by eliminating the myriad cases where KVM specifies '0' as a -dummy value. - -Suggested-by: Paolo Bonzini -Signed-off-by: Sean Christopherson -Signed-off-by: Paolo Bonzini -Stable-dep-of: 3be29eb7b525 ("KVM: x86: Report error when setting CPUID if Hyper-V allocation fails") -Signed-off-by: Sasha Levin ---- - arch/x86/kvm/cpuid.c | 80 +++++++++++++++++++++++++++--------- - arch/x86/kvm/cpuid.h | 16 ++++---- - arch/x86/kvm/hyperv.c | 8 ++-- - arch/x86/kvm/svm/svm.c | 2 +- - arch/x86/kvm/vmx/pmu_intel.c | 4 +- - arch/x86/kvm/vmx/sgx.c | 8 ++-- - arch/x86/kvm/vmx/vmx.c | 6 +-- - arch/x86/kvm/x86.c | 2 +- - 8 files changed, 84 insertions(+), 42 deletions(-) - -diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c -index cb14441cee37..797348378006 100644 ---- a/arch/x86/kvm/cpuid.c -+++ b/arch/x86/kvm/cpuid.c -@@ -67,9 +67,17 @@ u32 xstate_required_size(u64 xstate_bv, bool compacted) - #define F feature_bit - #define SF(name) (boot_cpu_has(X86_FEATURE_##name) ? F(name) : 0) - -+/* -+ * Magic value used by KVM when querying userspace-provided CPUID entries and -+ * doesn't care about the CPIUD index because the index of the function in -+ * question is not significant. Note, this magic value must have at least one -+ * bit set in bits[63:32] and must be consumed as a u64 by cpuid_entry2_find() -+ * to avoid false positives when processing guest CPUID input. -+ */ -+#define KVM_CPUID_INDEX_NOT_SIGNIFICANT -1ull - - static inline struct kvm_cpuid_entry2 *cpuid_entry2_find( -- struct kvm_cpuid_entry2 *entries, int nent, u32 function, u32 index) -+ struct kvm_cpuid_entry2 *entries, int nent, u32 function, u64 index) - { - struct kvm_cpuid_entry2 *e; - int i; -@@ -77,9 +85,31 @@ static inline struct kvm_cpuid_entry2 *cpuid_entry2_find( - for (i = 0; i < nent; i++) { - e = &entries[i]; - -- if (e->function == function && -- (!(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) || e->index == index)) -+ if (e->function != function) -+ continue; -+ -+ /* -+ * If the index isn't significant, use the first entry with a -+ * matching function. It's userspace's responsibilty to not -+ * provide "duplicate" entries in all cases. -+ */ -+ if (!(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) || e->index == index) -+ return e; -+ -+ -+ /* -+ * Similarly, use the first matching entry if KVM is doing a -+ * lookup (as opposed to emulating CPUID) for a function that's -+ * architecturally defined as not having a significant index. -+ */ -+ if (index == KVM_CPUID_INDEX_NOT_SIGNIFICANT) { -+ /* -+ * Direct lookups from KVM should not diverge from what -+ * KVM defines internally (the architectural behavior). -+ */ -+ WARN_ON_ONCE(cpuid_function_is_indexed(function)); - return e; -+ } - } - - return NULL; -@@ -96,7 +126,8 @@ static int kvm_check_cpuid(struct kvm_vcpu *vcpu, - * The existing code assumes virtual address is 48-bit or 57-bit in the - * canonical address checks; exit if it is ever changed. - */ -- best = cpuid_entry2_find(entries, nent, 0x80000008, 0); -+ best = cpuid_entry2_find(entries, nent, 0x80000008, -+ KVM_CPUID_INDEX_NOT_SIGNIFICANT); - if (best) { - int vaddr_bits = (best->eax & 0xff00) >> 8; - -@@ -151,7 +182,7 @@ static void kvm_update_kvm_cpuid_base(struct kvm_vcpu *vcpu) - vcpu->arch.kvm_cpuid_base = 0; - - for_each_possible_hypervisor_cpuid_base(function) { -- entry = kvm_find_cpuid_entry(vcpu, function, 0); -+ entry = kvm_find_cpuid_entry(vcpu, function); - - if (entry) { - u32 signature[3]; -@@ -177,7 +208,8 @@ static struct kvm_cpuid_entry2 *__kvm_find_kvm_cpuid_features(struct kvm_vcpu *v - if (!base) - return NULL; - -- return cpuid_entry2_find(entries, nent, base | KVM_CPUID_FEATURES, 0); -+ return cpuid_entry2_find(entries, nent, base | KVM_CPUID_FEATURES, -+ KVM_CPUID_INDEX_NOT_SIGNIFICANT); - } - - static struct kvm_cpuid_entry2 *kvm_find_kvm_cpuid_features(struct kvm_vcpu *vcpu) -@@ -219,7 +251,7 @@ static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_e - struct kvm_cpuid_entry2 *best; - u64 guest_supported_xcr0 = cpuid_get_supported_xcr0(entries, nent); - -- best = cpuid_entry2_find(entries, nent, 1, 0); -+ best = cpuid_entry2_find(entries, nent, 1, KVM_CPUID_INDEX_NOT_SIGNIFICANT); - if (best) { - /* Update OSXSAVE bit */ - if (boot_cpu_has(X86_FEATURE_XSAVE)) -@@ -250,7 +282,7 @@ static void __kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu, struct kvm_cpuid_e - best->eax &= ~(1 << KVM_FEATURE_PV_UNHALT); - - if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT)) { -- best = cpuid_entry2_find(entries, nent, 0x1, 0); -+ best = cpuid_entry2_find(entries, nent, 0x1, KVM_CPUID_INDEX_NOT_SIGNIFICANT); - if (best) - cpuid_entry_change(best, X86_FEATURE_MWAIT, - vcpu->arch.ia32_misc_enable_msr & -@@ -284,7 +316,7 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) - struct kvm_lapic *apic = vcpu->arch.apic; - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 1, 0); -+ best = kvm_find_cpuid_entry(vcpu, 1); - if (best && apic) { - if (cpuid_entry_has(best, X86_FEATURE_TSC_DEADLINE_TIMER)) - apic->lapic_timer.timer_mode_mask = 3 << 17; -@@ -330,10 +362,10 @@ int cpuid_query_maxphyaddr(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0x80000000, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x80000000); - if (!best || best->eax < 0x80000008) - goto not_found; -- best = kvm_find_cpuid_entry(vcpu, 0x80000008, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x80000008); - if (best) - return best->eax & 0xff; - not_found: -@@ -1316,12 +1348,20 @@ int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid, - return r; - } - --struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, -- u32 function, u32 index) -+struct kvm_cpuid_entry2 *kvm_find_cpuid_entry_index(struct kvm_vcpu *vcpu, -+ u32 function, u32 index) - { - return cpuid_entry2_find(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent, - function, index); - } -+EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry_index); -+ -+struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, -+ u32 function) -+{ -+ return cpuid_entry2_find(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent, -+ function, KVM_CPUID_INDEX_NOT_SIGNIFICANT); -+} - EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry); - - /* -@@ -1358,7 +1398,7 @@ get_out_of_range_cpuid_entry(struct kvm_vcpu *vcpu, u32 *fn_ptr, u32 index) - struct kvm_cpuid_entry2 *basic, *class; - u32 function = *fn_ptr; - -- basic = kvm_find_cpuid_entry(vcpu, 0, 0); -+ basic = kvm_find_cpuid_entry(vcpu, 0); - if (!basic) - return NULL; - -@@ -1367,11 +1407,11 @@ get_out_of_range_cpuid_entry(struct kvm_vcpu *vcpu, u32 *fn_ptr, u32 index) - return NULL; - - if (function >= 0x40000000 && function <= 0x4fffffff) -- class = kvm_find_cpuid_entry(vcpu, function & 0xffffff00, 0); -+ class = kvm_find_cpuid_entry(vcpu, function & 0xffffff00); - else if (function >= 0xc0000000) -- class = kvm_find_cpuid_entry(vcpu, 0xc0000000, 0); -+ class = kvm_find_cpuid_entry(vcpu, 0xc0000000); - else -- class = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0); -+ class = kvm_find_cpuid_entry(vcpu, function & 0x80000000); - - if (class && function <= class->eax) - return NULL; -@@ -1389,7 +1429,7 @@ get_out_of_range_cpuid_entry(struct kvm_vcpu *vcpu, u32 *fn_ptr, u32 index) - * the effective CPUID entry is the max basic leaf. Note, the index of - * the original requested leaf is observed! - */ -- return kvm_find_cpuid_entry(vcpu, basic->eax, index); -+ return kvm_find_cpuid_entry_index(vcpu, basic->eax, index); - } - - bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, -@@ -1399,7 +1439,7 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, - struct kvm_cpuid_entry2 *entry; - bool exact, used_max_basic = false; - -- entry = kvm_find_cpuid_entry(vcpu, function, index); -+ entry = kvm_find_cpuid_entry_index(vcpu, function, index); - exact = !!entry; - - if (!entry && !exact_only) { -@@ -1428,7 +1468,7 @@ bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, - * exists. EDX can be copied from any existing index. - */ - if (function == 0xb || function == 0x1f) { -- entry = kvm_find_cpuid_entry(vcpu, function, 1); -+ entry = kvm_find_cpuid_entry_index(vcpu, function, 1); - if (entry) { - *ecx = index & 0xff; - *edx = entry->edx; -diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h -index 8a770b481d9d..d45ac1a14f7d 100644 ---- a/arch/x86/kvm/cpuid.h -+++ b/arch/x86/kvm/cpuid.h -@@ -13,8 +13,10 @@ void kvm_set_cpu_caps(void); - - void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu); - void kvm_update_pv_runtime(struct kvm_vcpu *vcpu); -+struct kvm_cpuid_entry2 *kvm_find_cpuid_entry_index(struct kvm_vcpu *vcpu, -+ u32 function, u32 index); - struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, -- u32 function, u32 index); -+ u32 function); - int kvm_dev_ioctl_get_cpuid(struct kvm_cpuid2 *cpuid, - struct kvm_cpuid_entry2 __user *entries, - unsigned int type); -@@ -76,7 +78,7 @@ static __always_inline u32 *guest_cpuid_get_register(struct kvm_vcpu *vcpu, - const struct cpuid_reg cpuid = x86_feature_cpuid(x86_feature); - struct kvm_cpuid_entry2 *entry; - -- entry = kvm_find_cpuid_entry(vcpu, cpuid.function, cpuid.index); -+ entry = kvm_find_cpuid_entry_index(vcpu, cpuid.function, cpuid.index); - if (!entry) - return NULL; - -@@ -109,7 +111,7 @@ static inline bool guest_cpuid_is_amd_or_hygon(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0); - return best && - (is_guest_vendor_amd(best->ebx, best->ecx, best->edx) || - is_guest_vendor_hygon(best->ebx, best->ecx, best->edx)); -@@ -119,7 +121,7 @@ static inline bool guest_cpuid_is_intel(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0); - return best && is_guest_vendor_intel(best->ebx, best->ecx, best->edx); - } - -@@ -127,7 +129,7 @@ static inline int guest_cpuid_family(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0x1, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x1); - if (!best) - return -1; - -@@ -138,7 +140,7 @@ static inline int guest_cpuid_model(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0x1, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x1); - if (!best) - return -1; - -@@ -149,7 +151,7 @@ static inline int guest_cpuid_stepping(struct kvm_vcpu *vcpu) - { - struct kvm_cpuid_entry2 *best; - -- best = kvm_find_cpuid_entry(vcpu, 0x1, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x1); - if (!best) - return -1; - -diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c -index e2e95a6fccfd..ed804447589c 100644 ---- a/arch/x86/kvm/hyperv.c -+++ b/arch/x86/kvm/hyperv.c -@@ -1992,7 +1992,7 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) - struct kvm_cpuid_entry2 *entry; - struct kvm_vcpu_hv *hv_vcpu; - -- entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_INTERFACE, 0); -+ entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_INTERFACE); - if (entry && entry->eax == HYPERV_CPUID_SIGNATURE_EAX) { - vcpu->arch.hyperv_enabled = true; - } else { -@@ -2005,7 +2005,7 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) - - hv_vcpu = to_hv_vcpu(vcpu); - -- entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_FEATURES, 0); -+ entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_FEATURES); - if (entry) { - hv_vcpu->cpuid_cache.features_eax = entry->eax; - hv_vcpu->cpuid_cache.features_ebx = entry->ebx; -@@ -2016,7 +2016,7 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) - hv_vcpu->cpuid_cache.features_edx = 0; - } - -- entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_ENLIGHTMENT_INFO, 0); -+ entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_ENLIGHTMENT_INFO); - if (entry) { - hv_vcpu->cpuid_cache.enlightenments_eax = entry->eax; - hv_vcpu->cpuid_cache.enlightenments_ebx = entry->ebx; -@@ -2025,7 +2025,7 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) - hv_vcpu->cpuid_cache.enlightenments_ebx = 0; - } - -- entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES, 0); -+ entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES); - if (entry) - hv_vcpu->cpuid_cache.syndbg_cap_eax = entry->eax; - else -diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c -index 92b30b4937fc..274343f70eb9 100644 ---- a/arch/x86/kvm/svm/svm.c -+++ b/arch/x86/kvm/svm/svm.c -@@ -4058,7 +4058,7 @@ static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) - - /* For sev guests, the memory encryption bit is not reserved in CR3. */ - if (sev_guest(vcpu->kvm)) { -- best = kvm_find_cpuid_entry(vcpu, 0x8000001F, 0); -+ best = kvm_find_cpuid_entry(vcpu, 0x8000001F); - if (best) - vcpu->arch.reserved_gpa_bits &= ~(1UL << (best->ebx & 0x3f)); - } -diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c -index a9280ebf78f5..c8ca47221ae5 100644 ---- a/arch/x86/kvm/vmx/pmu_intel.c -+++ b/arch/x86/kvm/vmx/pmu_intel.c -@@ -495,7 +495,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) - pmu->global_ovf_ctrl_mask = ~0ull; - pmu->fixed_ctr_ctrl_mask = ~0ull; - -- entry = kvm_find_cpuid_entry(vcpu, 0xa, 0); -+ entry = kvm_find_cpuid_entry(vcpu, 0xa); - if (!entry || !vcpu->kvm->arch.enable_pmu) - return; - eax.full = entry->eax; -@@ -541,7 +541,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) - pmu->global_ovf_ctrl_mask &= - ~MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI; - -- entry = kvm_find_cpuid_entry(vcpu, 7, 0); -+ entry = kvm_find_cpuid_entry_index(vcpu, 7, 0); - if (entry && - (boot_cpu_has(X86_FEATURE_HLE) || boot_cpu_has(X86_FEATURE_RTM)) && - (entry->ebx & (X86_FEATURE_HLE|X86_FEATURE_RTM))) { -diff --git a/arch/x86/kvm/vmx/sgx.c b/arch/x86/kvm/vmx/sgx.c -index 35e7ec91ae86..d1cc7244bede 100644 ---- a/arch/x86/kvm/vmx/sgx.c -+++ b/arch/x86/kvm/vmx/sgx.c -@@ -148,8 +148,8 @@ static int __handle_encls_ecreate(struct kvm_vcpu *vcpu, - u8 max_size_log2; - int trapnr, ret; - -- sgx_12_0 = kvm_find_cpuid_entry(vcpu, 0x12, 0); -- sgx_12_1 = kvm_find_cpuid_entry(vcpu, 0x12, 1); -+ sgx_12_0 = kvm_find_cpuid_entry_index(vcpu, 0x12, 0); -+ sgx_12_1 = kvm_find_cpuid_entry_index(vcpu, 0x12, 1); - if (!sgx_12_0 || !sgx_12_1) { - kvm_prepare_emulation_failure_exit(vcpu); - return 0; -@@ -431,7 +431,7 @@ static bool sgx_intercept_encls_ecreate(struct kvm_vcpu *vcpu) - if (!vcpu->kvm->arch.sgx_provisioning_allowed) - return true; - -- guest_cpuid = kvm_find_cpuid_entry(vcpu, 0x12, 0); -+ guest_cpuid = kvm_find_cpuid_entry_index(vcpu, 0x12, 0); - if (!guest_cpuid) - return true; - -@@ -439,7 +439,7 @@ static bool sgx_intercept_encls_ecreate(struct kvm_vcpu *vcpu) - if (guest_cpuid->ebx != ebx || guest_cpuid->edx != edx) - return true; - -- guest_cpuid = kvm_find_cpuid_entry(vcpu, 0x12, 1); -+ guest_cpuid = kvm_find_cpuid_entry_index(vcpu, 0x12, 1); - if (!guest_cpuid) - return true; - -diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c -index 98526e708f32..c02803d9f7e7 100644 ---- a/arch/x86/kvm/vmx/vmx.c -+++ b/arch/x86/kvm/vmx/vmx.c -@@ -7319,7 +7319,7 @@ static void nested_vmx_cr_fixed1_bits_update(struct kvm_vcpu *vcpu) - vmx->nested.msrs.cr4_fixed1 |= (_cr4_mask); \ - } while (0) - -- entry = kvm_find_cpuid_entry(vcpu, 0x1, 0); -+ entry = kvm_find_cpuid_entry(vcpu, 0x1); - cr4_fixed1_update(X86_CR4_VME, edx, feature_bit(VME)); - cr4_fixed1_update(X86_CR4_PVI, edx, feature_bit(VME)); - cr4_fixed1_update(X86_CR4_TSD, edx, feature_bit(TSC)); -@@ -7335,7 +7335,7 @@ static void nested_vmx_cr_fixed1_bits_update(struct kvm_vcpu *vcpu) - cr4_fixed1_update(X86_CR4_PCIDE, ecx, feature_bit(PCID)); - cr4_fixed1_update(X86_CR4_OSXSAVE, ecx, feature_bit(XSAVE)); - -- entry = kvm_find_cpuid_entry(vcpu, 0x7, 0); -+ entry = kvm_find_cpuid_entry_index(vcpu, 0x7, 0); - cr4_fixed1_update(X86_CR4_FSGSBASE, ebx, feature_bit(FSGSBASE)); - cr4_fixed1_update(X86_CR4_SMEP, ebx, feature_bit(SMEP)); - cr4_fixed1_update(X86_CR4_SMAP, ebx, feature_bit(SMAP)); -@@ -7370,7 +7370,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) - int i; - - for (i = 0; i < PT_CPUID_LEAVES; i++) { -- best = kvm_find_cpuid_entry(vcpu, 0x14, i); -+ best = kvm_find_cpuid_entry_index(vcpu, 0x14, i); - if (!best) - return; - vmx->pt_desc.caps[CPUID_EAX + i*PT_CPUID_REGS_NUM] = best->eax; -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 8c2815151864..8304600d388a 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -11550,7 +11550,7 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) - * i.e. it's impossible for kvm_find_cpuid_entry() to find a valid entry - * on RESET. But, go through the motions in case that's ever remedied. - */ -- cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0); -+ cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1); - kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600); - - static_call(kvm_x86_vcpu_reset)(vcpu, init_event); --- -2.35.1 - diff --git a/queue-5.19/kvm-x86-check-for-existing-hyper-v-vcpu-in-kvm_hv_vc.patch b/queue-5.19/kvm-x86-check-for-existing-hyper-v-vcpu-in-kvm_hv_vc.patch deleted file mode 100644 index 27077233b0a..00000000000 --- a/queue-5.19/kvm-x86-check-for-existing-hyper-v-vcpu-in-kvm_hv_vc.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 19d8fd74cc7e93d4039147d85cb66be92adbb285 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Signed-off-by: Vitaly Kuznetsov -Signed-off-by: Sean Christopherson -Reviewed-by: Wei Liu -Link: https://lore.kernel.org/r/20220830133737.1539624-5-vkuznets@redhat.com -Signed-off-by: Paolo Bonzini -Stable-dep-of: 3be29eb7b525 ("KVM: x86: Report error when setting CPUID if Hyper-V allocation fails") -Signed-off-by: Sasha Levin ---- - 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 611c349a08bf..8aadd31ed058 100644 ---- a/arch/x86/kvm/hyperv.c -+++ b/arch/x86/kvm/hyperv.c -@@ -936,9 +936,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; -@@ -962,11 +965,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); - -@@ -1660,10 +1661,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; -@@ -1683,10 +1682,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; -@@ -2000,7 +1997,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 - diff --git a/queue-5.19/kvm-x86-mmu-fix-memoryleak-in-kvm_mmu_vendor_module_.patch b/queue-5.19/kvm-x86-mmu-fix-memoryleak-in-kvm_mmu_vendor_module_.patch deleted file mode 100644 index 03793a1d670..00000000000 --- a/queue-5.19/kvm-x86-mmu-fix-memoryleak-in-kvm_mmu_vendor_module_.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a85d47c2abf7acaa00f87b7ef6b444931736428d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 23 Aug 2022 14:32:37 +0800 -Subject: KVM: x86/mmu: fix memoryleak in kvm_mmu_vendor_module_init() - -From: Miaohe Lin - -[ 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 -Link: https://lore.kernel.org/r/20220823063237.47299-1-linmiaohe@huawei.com -[sean: tweak shortlog and changelog] -Signed-off-by: Sean Christopherson -Signed-off-by: Sasha Levin ---- - 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 aa1ba803659c..3011c32ec79e 100644 ---- a/arch/x86/kvm/mmu/mmu.c -+++ b/arch/x86/kvm/mmu/mmu.c -@@ -6292,10 +6292,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 - diff --git a/queue-5.19/kvm-x86-report-error-when-setting-cpuid-if-hyper-v-a.patch b/queue-5.19/kvm-x86-report-error-when-setting-cpuid-if-hyper-v-a.patch deleted file mode 100644 index de5cbd4f125..00000000000 --- a/queue-5.19/kvm-x86-report-error-when-setting-cpuid-if-hyper-v-a.patch +++ /dev/null @@ -1,173 +0,0 @@ -From ba1f6aa447184d0452a84bd87b2dc6b2d06ee99b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 30 Aug 2022 15:37:09 +0200 -Subject: KVM: x86: Report error when setting CPUID if Hyper-V allocation fails - -From: Sean Christopherson - -[ Upstream commit 3be29eb7b5251a772e2033761a9b67981fdfb0f7 ] - -Return -ENOMEM back to userspace if allocating the Hyper-V vCPU struct -fails when enabling Hyper-V in guest CPUID. Silently ignoring failure -means that KVM will not have an up-to-date CPUID cache if allocating the -struct succeeds later on, e.g. when activating SynIC. - -Rejecting the CPUID operation also guarantess that vcpu->arch.hyperv is -non-NULL if hyperv_enabled is true, which will allow for additional -cleanup, e.g. in the eVMCS code. - -Note, the initialization needs to be done before CPUID is set, and more -subtly before kvm_check_cpuid(), which potentially enables dynamic -XFEATURES. Sadly, there's no easy way to avoid exposing Hyper-V details -to CPUID or vice versa. Expose kvm_hv_vcpu_init() and the Hyper-V CPUID -signature to CPUID instead of exposing cpuid_entry2_find() outside of -CPUID code. It's hard to envision kvm_hv_vcpu_init() being misused, -whereas cpuid_entry2_find() absolutely shouldn't be used outside of core -CPUID code. - -Fixes: 10d7bf1e46dc ("KVM: x86: hyper-v: Cache guest CPUID leaves determining features availability") -Signed-off-by: Sean Christopherson -Signed-off-by: Vitaly Kuznetsov -Signed-off-by: Sean Christopherson -Link: https://lore.kernel.org/r/20220830133737.1539624-6-vkuznets@redhat.com -Signed-off-by: Paolo Bonzini -Signed-off-by: Sasha Levin ---- - arch/x86/kvm/cpuid.c | 18 +++++++++++++++++- - arch/x86/kvm/hyperv.c | 30 ++++++++++++++---------------- - arch/x86/kvm/hyperv.h | 6 +++++- - 3 files changed, 36 insertions(+), 18 deletions(-) - -diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c -index 797348378006..1c9863f5b4f6 100644 ---- a/arch/x86/kvm/cpuid.c -+++ b/arch/x86/kvm/cpuid.c -@@ -311,6 +311,15 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) - } - EXPORT_SYMBOL_GPL(kvm_update_cpuid_runtime); - -+static bool kvm_cpuid_has_hyperv(struct kvm_cpuid_entry2 *entries, int nent) -+{ -+ struct kvm_cpuid_entry2 *entry; -+ -+ entry = cpuid_entry2_find(entries, nent, HYPERV_CPUID_INTERFACE, -+ KVM_CPUID_INDEX_NOT_SIGNIFICANT); -+ return entry && entry->eax == HYPERV_CPUID_SIGNATURE_EAX; -+} -+ - static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) - { - struct kvm_lapic *apic = vcpu->arch.apic; -@@ -346,7 +355,8 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) - vcpu->arch.cr4_guest_rsvd_bits = - __cr4_reserved_bits(guest_cpuid_has, vcpu); - -- kvm_hv_set_cpuid(vcpu); -+ kvm_hv_set_cpuid(vcpu, kvm_cpuid_has_hyperv(vcpu->arch.cpuid_entries, -+ vcpu->arch.cpuid_nent)); - - /* Invoke the vendor callback only after the above state is updated. */ - static_call(kvm_x86_vcpu_after_set_cpuid)(vcpu); -@@ -409,6 +419,12 @@ static int kvm_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *e2, - return 0; - } - -+ if (kvm_cpuid_has_hyperv(e2, nent)) { -+ r = kvm_hv_vcpu_init(vcpu); -+ if (r) -+ return r; -+ } -+ - r = kvm_check_cpuid(vcpu, e2, nent); - if (r) - return r; -diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c -index 8aadd31ed058..bf4729e8cc80 100644 ---- a/arch/x86/kvm/hyperv.c -+++ b/arch/x86/kvm/hyperv.c -@@ -38,9 +38,6 @@ - #include "irq.h" - #include "fpu.h" - --/* "Hv#1" signature */ --#define HYPERV_CPUID_SIGNATURE_EAX 0x31237648 -- - #define KVM_HV_MAX_SPARSE_VCPU_SET_BITS DIV_ROUND_UP(KVM_MAX_VCPUS, 64) - - static void stimer_mark_pending(struct kvm_vcpu_hv_stimer *stimer, -@@ -934,7 +931,7 @@ static void stimer_init(struct kvm_vcpu_hv_stimer *stimer, int timer_index) - stimer_prepare_msg(stimer); - } - --static int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu) -+int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu) - { - struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); - int i; -@@ -1984,26 +1981,27 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc) - return HV_STATUS_SUCCESS; - } - --void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) -+void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu, bool hyperv_enabled) - { -+ struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); - struct kvm_cpuid_entry2 *entry; -- struct kvm_vcpu_hv *hv_vcpu; - -- entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_INTERFACE); -- if (entry && entry->eax == HYPERV_CPUID_SIGNATURE_EAX) { -- vcpu->arch.hyperv_enabled = true; -- } else { -- vcpu->arch.hyperv_enabled = false; -- return; -- } -+ vcpu->arch.hyperv_enabled = hyperv_enabled; - -- if (kvm_hv_vcpu_init(vcpu)) -+ if (!hv_vcpu) { -+ /* -+ * KVM should have already allocated kvm_vcpu_hv if Hyper-V is -+ * enabled in CPUID. -+ */ -+ WARN_ON_ONCE(vcpu->arch.hyperv_enabled); - return; -- -- hv_vcpu = to_hv_vcpu(vcpu); -+ } - - memset(&hv_vcpu->cpuid_cache, 0, sizeof(hv_vcpu->cpuid_cache)); - -+ if (!vcpu->arch.hyperv_enabled) -+ return; -+ - entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_FEATURES); - if (entry) { - hv_vcpu->cpuid_cache.features_eax = entry->eax; -diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h -index da2737f2a956..1030b1b50552 100644 ---- a/arch/x86/kvm/hyperv.h -+++ b/arch/x86/kvm/hyperv.h -@@ -23,6 +23,9 @@ - - #include - -+/* "Hv#1" signature */ -+#define HYPERV_CPUID_SIGNATURE_EAX 0x31237648 -+ - /* - * The #defines related to the synthetic debugger are required by KDNet, but - * they are not documented in the Hyper-V TLFS because the synthetic debugger -@@ -141,7 +144,8 @@ void kvm_hv_request_tsc_page_update(struct kvm *kvm); - - void kvm_hv_init_vm(struct kvm *kvm); - void kvm_hv_destroy_vm(struct kvm *kvm); --void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu); -+int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu); -+void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu, bool hyperv_enabled); - int kvm_hv_set_enforce_cpuid(struct kvm_vcpu *vcpu, bool enforce); - int kvm_vm_ioctl_hv_eventfd(struct kvm *kvm, struct kvm_hyperv_eventfd *args); - int kvm_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, --- -2.35.1 - diff --git a/queue-5.19/kvm-x86-zero-out-entire-hyper-v-cpuid-cache-before-p.patch b/queue-5.19/kvm-x86-zero-out-entire-hyper-v-cpuid-cache-before-p.patch deleted file mode 100644 index 74e3cedcea1..00000000000 --- a/queue-5.19/kvm-x86-zero-out-entire-hyper-v-cpuid-cache-before-p.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 994fa71e277e5d39f09d28b42e6549b905750238 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 30 Aug 2022 15:37:07 +0200 -Subject: KVM: x86: Zero out entire Hyper-V CPUID cache before processing - entries - -From: Vitaly Kuznetsov - -[ Upstream commit ce2196b831b1e9f8982b2904fc3e8658cc0e6573 ] - -Wipe the whole 'hv_vcpu->cpuid_cache' with memset() instead of having to -zero each particular member when the corresponding CPUID entry was not -found. - -No functional change intended. - -Signed-off-by: Vitaly Kuznetsov -[sean: split to separate patch] -Signed-off-by: Sean Christopherson -Reviewed-by: Wei Liu -Link: https://lore.kernel.org/r/20220830133737.1539624-4-vkuznets@redhat.com -Signed-off-by: Paolo Bonzini -Stable-dep-of: 3be29eb7b525 ("KVM: x86: Report error when setting CPUID if Hyper-V allocation fails") -Signed-off-by: Sasha Levin ---- - arch/x86/kvm/hyperv.c | 11 ++--------- - 1 file changed, 2 insertions(+), 9 deletions(-) - -diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c -index ed804447589c..611c349a08bf 100644 ---- a/arch/x86/kvm/hyperv.c -+++ b/arch/x86/kvm/hyperv.c -@@ -2005,31 +2005,24 @@ void kvm_hv_set_cpuid(struct kvm_vcpu *vcpu) - - hv_vcpu = to_hv_vcpu(vcpu); - -+ memset(&hv_vcpu->cpuid_cache, 0, sizeof(hv_vcpu->cpuid_cache)); -+ - entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_FEATURES); - if (entry) { - hv_vcpu->cpuid_cache.features_eax = entry->eax; - hv_vcpu->cpuid_cache.features_ebx = entry->ebx; - hv_vcpu->cpuid_cache.features_edx = entry->edx; -- } else { -- hv_vcpu->cpuid_cache.features_eax = 0; -- hv_vcpu->cpuid_cache.features_ebx = 0; -- hv_vcpu->cpuid_cache.features_edx = 0; - } - - entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_ENLIGHTMENT_INFO); - if (entry) { - hv_vcpu->cpuid_cache.enlightenments_eax = entry->eax; - hv_vcpu->cpuid_cache.enlightenments_ebx = entry->ebx; -- } else { -- hv_vcpu->cpuid_cache.enlightenments_eax = 0; -- hv_vcpu->cpuid_cache.enlightenments_ebx = 0; - } - - entry = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES); - if (entry) - hv_vcpu->cpuid_cache.syndbg_cap_eax = entry->eax; -- else -- hv_vcpu->cpuid_cache.syndbg_cap_eax = 0; - } - - int kvm_hv_set_enforce_cpuid(struct kvm_vcpu *vcpu, bool enforce) --- -2.35.1 - diff --git a/queue-5.19/series b/queue-5.19/series index 23d50dec5ff..0933d9adceb 100644 --- a/queue-5.19/series +++ b/queue-5.19/series @@ -476,7 +476,6 @@ clk-mediatek-mt8183-mfgcfg-propagate-rate-changes-to.patch clk-mediatek-clk-mt8195-mfg-reparent-mfg_bg3d-and-pr.patch clk-mediatek-fix-unregister-function-in-mtk_clk_regi.patch clk-mediatek-migrate-remaining-clk_unregister_-to-cl.patch -fs-don-t-randomize-struct-kiocb-fields.patch dmaengine-ioat-stop-mod_timer-from-resurrecting-dele.patch usb-mtu3-fix-failed-runtime-suspend-in-host-only-mod.patch spmi-pmic-arb-correct-duplicate-apid-to-ppid-mapping.patch @@ -493,7 +492,6 @@ 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 ipc-mqueue-fix-possible-memory-leak-in-init_mqueue_f.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 @@ -501,21 +499,7 @@ powerpc-pci_dn-add-missing-of_node_put.patch powerpc-powernv-add-missing-of_node_put-in-opal_expo.patch cpuidle-riscv-sbi-fix-cpu_pm_cpu_idle_enter_xyz-macr.patch powerpc-fix-fallocate-and-fadvise64_64-compat-parame.patch -kvm-fix-memoryleak-in-kvm_init.patch x86-hyperv-fix-struct-hv_enlightened_vmcs-definition.patch -kvm-x86-add-dedicated-helper-to-get-cpuid-entry-with.patch -kvm-x86-zero-out-entire-hyper-v-cpuid-cache-before-p.patch -kvm-x86-check-for-existing-hyper-v-vcpu-in-kvm_hv_vc.patch -kvm-x86-report-error-when-setting-cpuid-if-hyper-v-a.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 -kvm-ppc-book3s-hv-fix-decrementer-migration.patch -kvm-ppc-book3s-hv-p9-fix-irq-disabling-in-tick-accou.patch -kvm-ppc-book3s-hv-p9-clear-vcpu-cpu-fields-before-en.patch -kvm-ppc-book3s-hv-p9-restore-stolen-time-logging-in-.patch powerpc-64s-fix-generic_cpu-build-flags-for-ppc970-g.patch powerpc-64-mark-irqs-hard-disabled-in-boot-paca.patch powerpc-64-interrupt-fix-return-to-masked-context-af.patch @@ -527,9 +511,6 @@ crypto-hisilicon-zip-fix-mismatch-in-get-set-sgl_sge.patch hwrng-arm-smccc-trng-fix-no_entropy-handling.patch crypto-ccp-fail-the-psp-initialization-when-writing-.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 @@ -539,7 +520,6 @@ crypto-akcipher-default-implementation-for-setting-a.patch crypto-ccp-release-dma-channels-before-dmaengine-unr.patch crypto-inside-secure-change-swab-to-swab32.patch crypto-qat-fix-dma-transfer-direction.patch -dt-bindings-timer-add-nomadik-mtu-binding.patch clocksource-drivers-arm_arch_timer-fix-handling-of-a.patch clocksource-drivers-timer-gxp-add-missing-error-hand.patch cifs-return-correct-error-in-calc_signature.patch @@ -557,8 +537,6 @@ thermal-drivers-qcom-tsens-v0_1-fix-msm8939-fourth-s.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 module-tracking-keep-a-record-of-tainted-unloaded-mo.patch fs-dlm-fix-race-in-lowcomms.patch @@ -733,7 +711,6 @@ revert-net-ieee802154-reject-zero-sized-raw_sendmsg.patch net-ieee802154-don-t-warn-zero-sized-raw_sendmsg.patch powerpc-64s-interrupt-fix-lost-interrupts-when-returning-to-soft-masked-context.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 kbuild-add-skip_encoding_btf_enum64-option-to-pahole.patch kconfig.debug-simplify-the-dependency-of-debug_info_dwarf4-5.patch kconfig.debug-add-toolchain-checks-for-debug_info_dwarf_toolchain_default.patch diff --git a/queue-5.19/tools-power-turbostat-separate-spr-from-icx.patch b/queue-5.19/tools-power-turbostat-separate-spr-from-icx.patch deleted file mode 100644 index 56dc99a00d7..00000000000 --- a/queue-5.19/tools-power-turbostat-separate-spr-from-icx.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 23002bdda6c44918946a420e43e609ca4f60df04 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 26 Jul 2022 18:29:32 +0300 -Subject: tools/power turbostat: separate SPR from ICX - -From: Artem Bityutskiy - -[ 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 -Reviewed-by: Chen Yu -Signed-off-by: Len Brown -Stable-dep-of: b2d433ae6376 ("tools/power turbostat: Use standard Energy Unit for SPR Dram RAPL domain") -Signed-off-by: Sasha Levin ---- - 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 2e9a751af260..c674d397a702 100644 ---- a/tools/power/x86/turbostat/turbostat.c -+++ b/tools/power/x86/turbostat/turbostat.c -@@ -2494,6 +2494,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; -@@ -3746,6 +3747,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; -@@ -3871,6 +3873,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) -@@ -3988,6 +4006,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; -@@ -4015,7 +4034,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: -@@ -4486,6 +4505,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); -@@ -4575,6 +4595,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 | -@@ -4740,13 +4761,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; - } - -@@ -4975,6 +4996,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 */ -@@ -5367,7 +5389,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; -@@ -5654,7 +5675,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 - diff --git a/queue-5.19/tools-power-turbostat-use-standard-energy-unit-for-s.patch b/queue-5.19/tools-power-turbostat-use-standard-energy-unit-for-s.patch deleted file mode 100644 index 1fd2d76d5ed..00000000000 --- a/queue-5.19/tools-power-turbostat-use-standard-energy-unit-for-s.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 6b16a104e789ae18df740c3d5ed7343d70616c3f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -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 - -[ 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 -Tested-by: Wang Wendy -Signed-off-by: Len Brown -Signed-off-by: Sasha Levin ---- - 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 c674d397a702..cd60bc4d4300 100644 ---- a/tools/power/x86/turbostat/turbostat.c -+++ b/tools/power/x86/turbostat/turbostat.c -@@ -4505,7 +4505,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 -