* [PATCH 00/18] pwm: Provide devm_pwmchip_alloc() function
From: Uwe Kleine-König @ 2023-07-18 18:18 UTC (permalink / raw)
To: Jonathan Corbet, Thierry Reding, Yang Yingliang, Andy Shevchenko,
Greg Kroah-Hartman, Mark Brown, Matti Vaittinen, James Clark,
Hector Martin, Sven Peter, Shawn Guo, Sascha Hauer, Paul Cercueil,
Vladimir Zapolskiy, Jonathan Neuschäfer, Fabrice Gasnier,
Maxime Coquelin, Alexandre Torgue, Linus Walleij,
Bartosz Golaszewski
Cc: linux-doc, kernel, linux-pwm, Alyssa Rosenzweig, asahi,
linux-arm-kernel, Fabio Estevam, NXP Linux Team, linux-mips,
linux-stm32, Andy Shevchenko, linux-gpio, Wolfram Sang
Hello,
my eventual goal is to provide a chardev API to PWMs similar to the gpioctl
API. For that to work flawlessly it's required that a pwmchip stays
around while the corresponding device is opened even if the respective
lowlevel driver goes away. See Wolfram's EOSS talk[1] for some more
details.
This series provides a new function devm_pwmchip_alloc() that allocates
a struct pwm_chip together with driver data. Currently this is still
using devm_kzalloc and so goes away when the device is unbound from the
driver. However this can be changed without having to touch all drivers
again.
The function devm_pwmchip_alloc() is modelled after similar functions
from spi, counter and networking code. The first patch provides the
allocator function and an accessor for driver data, the following
patches convert a subset of the available drivers to this new API.
The series is fully bisectable and the only interdependency is that
patch #1 is needed for all other patches. The idea is to complete
conversion of all remaining drivers and then add a struct device to
struct pwm_chip and so make pwm_chip reference counted. There are still
a few more drivers to convert, but I thought to send out the current
patch set to get some early feedback.
The base for this series is v6.5-rc1 plus the following series:
[PATCH v2 0/8] pwm: Get rid of pwm_[sg]et_chip_data()
20230705080650.2353391-1-u.kleine-koenig@pengutronix.de
[PATCH 0/2] pwm: stm32: A (small) fix and a cleanup
20230713155142.2454010-1-u.kleine-koenig@pengutronix.de
[PATCH 00/10] pwm: Constistenly name pwm_chip variables "chip"
20230714205623.2496590-1-u.kleine-koenig@pengutronix.de
[PATCH] staging: greybus: pwm: Drop unused member from driver struct
20230714201622.2490792-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: lpc18xx-sct: Simplify using devm_clk_get_enabled()
20230718144128.371818-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: lpc32xx: remove handling of PWM channels
20230717155257.2568627-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: pxa: Don't reimplement of_device_get_match_data()
20230718150657.1728166-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: ntxec: Drop a write-only variable from driver data
20230718152327.2583886-1-u.kleine-koenig@pengutronix.de
[PATCH] gpio: mvebu: Make use of devm_pwmchip_add
20230717142743.2555739-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: ntxec: Use device_set_of_node_from_dev()
20230718175310.3946687-1-u.kleine-koenig@pengutronix.de
[PATCH] pwm: berlin: Simplify using devm functions
20230718175545.3946935-1-u.kleine-koenig@pengutronix.de
I'm not sure the build bots can properly handle that, so it would be
great to get these base series into next soon.
Best regards
Uwe
[1] https://static.sched.com/hosted_files/eoss2023/e3/LifecycleIssues_WolframSang_2023.pdf
Uwe Kleine-König (18):
pwm: Provide devm_pwmchip_alloc() function
pwm: ab8500: Make use of devm_pwmchip_alloc() function
pwm: apple: Make use of devm_pwmchip_alloc() function
pwm: berlin: Make use of devm_pwmchip_alloc() function
pwm: clk: Make use of devm_pwmchip_alloc() function
pwm: fsl-ftm: Make use of devm_pwmchip_alloc() function
pwm: hibvt: Make use of devm_pwmchip_alloc() function
pwm: imx1: Make use of devm_pwmchip_alloc() function
pwm: imx27: Make use of devm_pwmchip_alloc() function
pwm: jz4740: Make use of devm_pwmchip_alloc() function
pwm: keembay: Make use of devm_pwmchip_alloc() function
pwm: lpc18xx-sct: Make use of devm_pwmchip_alloc() function
pwm: lpc32xx: Make use of devm_pwmchip_alloc() function
pwm: mxs: Make use of devm_pwmchip_alloc() function
pwm: ntxec: Make use of devm_pwmchip_alloc() function
pwm: pxa: Make use of devm_pwmchip_alloc() function
pwm: stm32: Make use of devm_pwmchip_alloc() function
gpio: mvebu: Make use of devm_pwmchip_alloc() function
.../driver-api/driver-model/devres.rst | 1 +
Documentation/driver-api/pwm.rst | 10 ++--
drivers/gpio/gpio-mvebu.c | 17 +++----
drivers/pwm/core.c | 23 +++++++++
drivers/pwm/pwm-ab8500.c | 17 +++----
drivers/pwm/pwm-apple.c | 17 +++----
drivers/pwm/pwm-berlin.c | 28 ++++++-----
drivers/pwm/pwm-clk.c | 26 +++++-----
drivers/pwm/pwm-fsl-ftm.c | 47 ++++++++++---------
drivers/pwm/pwm-hibvt.c | 26 +++++-----
drivers/pwm/pwm-imx1.c | 16 +++----
drivers/pwm/pwm-imx27.c | 19 ++++----
drivers/pwm/pwm-jz4740.c | 25 +++++-----
drivers/pwm/pwm-keembay.c | 16 +++----
drivers/pwm/pwm-lpc18xx-sct.c | 24 +++++-----
drivers/pwm/pwm-lpc32xx.c | 18 +++----
drivers/pwm/pwm-mxs.c | 19 ++++----
drivers/pwm/pwm-ntxec.c | 27 +++++------
drivers/pwm/pwm-pxa.c | 20 ++++----
drivers/pwm/pwm-stm32.c | 42 +++++++++++------
include/linux/pwm.h | 4 ++
21 files changed, 249 insertions(+), 193 deletions(-)
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
prerequisite-patch-id: c856e0baabfc22d250b7ce881427cdb74613e69a
prerequisite-patch-id: 2a5f9c04e4b5794b5a5d0b30280f75b76a05092b
prerequisite-patch-id: a48b05b94b61f8029b4bb9a78ae1f2cd8c476d80
prerequisite-patch-id: c7dfd3798f024b27b6e236da1eae40b79bb3e281
prerequisite-patch-id: 313ada72ab57438a8d54df0df9c0926bb4f69b36
prerequisite-patch-id: 318824c08f3e7d6500e3c5a47a11c5daffaea34a
prerequisite-patch-id: ea75bfd48ea4d0132c637172564bc1a57061377a
prerequisite-patch-id: 278b25a8d5fef49f7e5c46b627d4862d0b24baaf
prerequisite-patch-id: a3b11e0a7c8f6564e668e2ed1b637351e5fd9dd2
prerequisite-patch-id: 55588b25ea7ce69d716a33a7aaed662d75bb9687
prerequisite-patch-id: 399d7e94bafc5dc970a0f213745e4982066b8583
prerequisite-patch-id: 87aca1beb6efdaab95ddce7e2d9eed89a89252a1
prerequisite-patch-id: e13e3db807f2c5b49180e24492f496f8e945e42d
prerequisite-patch-id: 8712b17dee2a5f2441908e2de260ceec8ce6ff37
prerequisite-patch-id: 987b0a351801b1e361932beeeedbc5245540037c
prerequisite-patch-id: 869d3932983f3ae6a8982e186b27df11c56e9e5e
prerequisite-patch-id: 4f60b0afb435011b58b7cc6bead1d385db7d8e11
prerequisite-patch-id: 0e86da52c02300d407d4c0b6f2b9f8293e3320dc
prerequisite-patch-id: a731856f5d7dee7f3465f021e5c56981a803b22d
prerequisite-patch-id: b759d036cf578083ec76aa7ba01dd8643667d4f6
prerequisite-patch-id: 9abd8b16e74625e2630655da7d22e75bbe0c6231
prerequisite-patch-id: 6ad03ceb505a293f2308235161c54ff6b508e59f
prerequisite-patch-id: cb6d75be9b72cc04069b6952ba9e5ac80a26a1ab
prerequisite-patch-id: c8fa7296a736f42ec49ab1334cb19947d647a2b4
prerequisite-patch-id: b601ea695815fb65ed704349302ba66442277fc3
prerequisite-patch-id: 7a0daa2918f8a317333e57c1d1698078a1968720
prerequisite-patch-id: b6762f6deeb74aaf73afe2d8dd816d48cec4e1ee
prerequisite-patch-id: a0c8d63424241e64c3e5f9991ea04018a51fcc94
--
2.39.2
^ permalink raw reply
* [PATCH 10/18] pwm: jz4740: Make use of devm_pwmchip_alloc() function
From: Uwe Kleine-König @ 2023-07-18 18:18 UTC (permalink / raw)
To: Paul Cercueil, Thierry Reding; +Cc: linux-mips, linux-pwm, kernel
In-Reply-To: <20230718181849.3947851-1-u.kleine-koenig@pengutronix.de>
This prepares the pwm-jz4740 driver to further changes of the pwm core
outlined in the commit introducing devm_pwmchip_alloc(). There is no
intended semantical change and the driver should behave as before.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-jz4740.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 8b01819df67d..de3b891f1ceb 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -25,23 +25,22 @@ struct soc_info {
};
struct jz4740_pwm_chip {
- struct pwm_chip chip;
struct regmap *map;
struct clk *clk[];
};
static inline struct jz4740_pwm_chip *to_jz4740(struct pwm_chip *chip)
{
- return container_of(chip, struct jz4740_pwm_chip, chip);
+ return pwmchip_priv(chip);
}
-static bool jz4740_pwm_can_use_chn(struct jz4740_pwm_chip *jz,
+static bool jz4740_pwm_can_use_chn(struct pwm_chip *chip,
unsigned int channel)
{
/* Enable all TCU channels for PWM use by default except channels 0/1 */
- u32 pwm_channels_mask = GENMASK(jz->chip.npwm - 1, 2);
+ u32 pwm_channels_mask = GENMASK(chip->npwm - 1, 2);
- device_property_read_u32(jz->chip.dev->parent,
+ device_property_read_u32(chip->dev->parent,
"ingenic,pwm-channels-mask",
&pwm_channels_mask);
@@ -55,7 +54,7 @@ static int jz4740_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
char name[16];
int err;
- if (!jz4740_pwm_can_use_chn(jz, pwm->hwpwm))
+ if (!jz4740_pwm_can_use_chn(chip, pwm->hwpwm))
return -EBUSY;
snprintf(name, sizeof(name), "timer%u", pwm->hwpwm);
@@ -224,6 +223,7 @@ static const struct pwm_ops jz4740_pwm_ops = {
static int jz4740_pwm_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct pwm_chip *chip;
struct jz4740_pwm_chip *jz4740;
const struct soc_info *info;
@@ -231,10 +231,10 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
if (!info)
return -EINVAL;
- jz4740 = devm_kzalloc(dev, struct_size(jz4740, clk, info->num_pwms),
- GFP_KERNEL);
- if (!jz4740)
+ chip = devm_pwmchip_alloc(dev, struct_size(jz4740, clk, info->num_pwms));
+ if (!chip)
return -ENOMEM;
+ jz4740 = to_jz4740(chip);
jz4740->map = device_node_to_regmap(dev->parent->of_node);
if (IS_ERR(jz4740->map)) {
@@ -242,11 +242,10 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
return PTR_ERR(jz4740->map);
}
- jz4740->chip.dev = dev;
- jz4740->chip.ops = &jz4740_pwm_ops;
- jz4740->chip.npwm = info->num_pwms;
+ chip->ops = &jz4740_pwm_ops;
+ chip->npwm = info->num_pwms;
- return devm_pwmchip_add(dev, &jz4740->chip);
+ return devm_pwmchip_add(dev, chip);
}
static const struct soc_info jz4740_soc_info = {
--
2.39.2
^ permalink raw reply related
* Re: [PATCH v6 06/11] KVM: arm64: Implement __kvm_tlb_flush_vmid_range()
From: Raghavendra Rao Ananta @ 2023-07-18 16:39 UTC (permalink / raw)
To: Shaoqin Huang
Cc: Oliver Upton, Marc Zyngier, James Morse, Suzuki K Poulose,
Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <0b2b367e-30c7-672e-f249-e4100c4dff5f@redhat.com>
On Tue, Jul 18, 2023 at 12:50 AM Shaoqin Huang <shahuang@redhat.com> wrote:
>
> Hi Raghavendra,
>
> On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> > Define __kvm_tlb_flush_vmid_range() (for VHE and nVHE)
> > to flush a range of stage-2 page-tables using IPA in one go.
> > If the system supports FEAT_TLBIRANGE, the following patches
> > would conviniently replace global TLBI such as vmalls12e1is
> > in the map, unmap, and dirty-logging paths with ripas2e1is
> > instead.
> >
> > Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> > Reviewed-by: Gavin Shan <gshan@redhat.com>
> > ---
> > arch/arm64/include/asm/kvm_asm.h | 3 +++
> > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 11 +++++++++++
> > arch/arm64/kvm/hyp/nvhe/tlb.c | 30 ++++++++++++++++++++++++++++++
> > arch/arm64/kvm/hyp/vhe/tlb.c | 23 +++++++++++++++++++++++
> > 4 files changed, 67 insertions(+)
> >
> > diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
> > index 7d170aaa2db4..2c27cb8cf442 100644
> > --- a/arch/arm64/include/asm/kvm_asm.h
> > +++ b/arch/arm64/include/asm/kvm_asm.h
> > @@ -70,6 +70,7 @@ enum __kvm_host_smccc_func {
> > __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa,
> > __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa_nsh,
> > __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid,
> > + __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_range,
> > __KVM_HOST_SMCCC_FUNC___kvm_flush_cpu_context,
> > __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntvoff,
> > __KVM_HOST_SMCCC_FUNC___vgic_v3_read_vmcr,
> > @@ -229,6 +230,8 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, phys_addr_t ipa,
> > extern void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> > phys_addr_t ipa,
> > int level);
> > +extern void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> > + phys_addr_t start, unsigned long pages);
> > extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu);
> >
> > extern void __kvm_timer_set_cntvoff(u64 cntvoff);
> > diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> > index a169c619db60..857d9bc04fd4 100644
> > --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> > +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> > @@ -135,6 +135,16 @@ static void handle___kvm_tlb_flush_vmid_ipa_nsh(struct kvm_cpu_context *host_ctx
> > __kvm_tlb_flush_vmid_ipa_nsh(kern_hyp_va(mmu), ipa, level);
> > }
> >
> > +static void
> > +handle___kvm_tlb_flush_vmid_range(struct kvm_cpu_context *host_ctxt)
> > +{
> > + DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
> > + DECLARE_REG(phys_addr_t, start, host_ctxt, 2);
> > + DECLARE_REG(unsigned long, pages, host_ctxt, 3);
> > +
> > + __kvm_tlb_flush_vmid_range(kern_hyp_va(mmu), start, pages);
> > +}
> > +
> > static void handle___kvm_tlb_flush_vmid(struct kvm_cpu_context *host_ctxt)
> > {
> > DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
> > @@ -327,6 +337,7 @@ static const hcall_t host_hcall[] = {
> > HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa),
> > HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa_nsh),
> > HANDLE_FUNC(__kvm_tlb_flush_vmid),
> > + HANDLE_FUNC(__kvm_tlb_flush_vmid_range),
> > HANDLE_FUNC(__kvm_flush_cpu_context),
> > HANDLE_FUNC(__kvm_timer_set_cntvoff),
> > HANDLE_FUNC(__vgic_v3_read_vmcr),
> > diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c
> > index b9991bbd8e3f..09347111c2cd 100644
> > --- a/arch/arm64/kvm/hyp/nvhe/tlb.c
> > +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
> > @@ -182,6 +182,36 @@ void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> > __tlb_switch_to_host(&cxt);
> > }
> >
> > +void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> > + phys_addr_t start, unsigned long pages)
> > +{
> > + struct tlb_inv_context cxt;
> > + unsigned long stride;
> > +
> > + /*
> > + * Since the range of addresses may not be mapped at
> > + * the same level, assume the worst case as PAGE_SIZE
> > + */
> > + stride = PAGE_SIZE;
> > + start = round_down(start, stride);
> > +
> > + /* Switch to requested VMID */
> > + __tlb_switch_to_guest(mmu, &cxt, false);
> > +
> > + __flush_tlb_range_op(ipas2e1is, start, pages, stride, 0, 0, false);
> > +
> > + dsb(ish);
> > + __tlbi(vmalle1is);
> > + dsb(ish);
> > + isb();
> > +
> > + /* See the comment in __kvm_tlb_flush_vmid_ipa() */
> > + if (icache_is_vpipt())
> > + icache_inval_all_pou();
> > +
> > + __tlb_switch_to_host(&cxt);
> > +}
> > +
> > void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu)
> > {
> > struct tlb_inv_context cxt;
> > diff --git a/arch/arm64/kvm/hyp/vhe/tlb.c b/arch/arm64/kvm/hyp/vhe/tlb.c
> > index e69da550cdc5..4ed8a1786812 100644
> > --- a/arch/arm64/kvm/hyp/vhe/tlb.c
> > +++ b/arch/arm64/kvm/hyp/vhe/tlb.c
> > @@ -138,6 +138,29 @@ void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> > dsb(nsh);
> > __tlbi(vmalle1);
> > dsb(nsh);
> > +
> > + __tlb_switch_to_host(&cxt);
> > +}
> > +
> > +void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> > + phys_addr_t start, unsigned long pages)
> > +{
> > + struct tlb_inv_context cxt;
> > + unsigned long stride;
> > +
> > + /*
> > + * Since the range of addresses may not be mapped at
> > + * the same level, assume the worst case as PAGE_SIZE
> > + */
> > + stride = PAGE_SIZE;
> > + start = round_down(start, stride);
> > +
>
> Is there lack of switch VMID to guest?
> __tlb_switch_to_guest(mmu, &cxt, false);
>
Oh right, we should have that (I think I messed up the conflict
resolution when rebasing the series to 6.5-rc1). Thanks for pointing
this out! I'll fix it in v7.
- Raghavendra
> Thanks,
> Shaoqin
>
> > + dsb(ishst);
> > + __flush_tlb_range_op(ipas2e1is, start, pages, stride, 0, 0, false);
> > +
> > + dsb(ish);
> > + __tlbi(vmalle1is);
> > + dsb(ish);
> > isb();
> >
> > __tlb_switch_to_host(&cxt);
>
> --
> Shaoqin
>
^ permalink raw reply
* Re: [PATCH v6 03/11] KVM: Allow range-based TLB invalidation from common code
From: Raghavendra Rao Ananta @ 2023-07-18 16:31 UTC (permalink / raw)
To: Shaoqin Huang
Cc: Oliver Upton, Marc Zyngier, James Morse, Suzuki K Poulose,
Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <fb52139b-5854-6370-7de3-bd87b31e3148@redhat.com>
Hi Shaoqin,
On Mon, Jul 17, 2023 at 7:49 PM Shaoqin Huang <shahuang@redhat.com> wrote:
>
>
>
> On 7/18/23 00:37, Raghavendra Rao Ananta wrote:
> > On Mon, Jul 17, 2023 at 4:40 AM Shaoqin Huang <shahuang@redhat.com> wrote:
> >>
> >>
> >>
> >> On 7/15/23 08:53, Raghavendra Rao Ananta wrote:
> >>> From: David Matlack <dmatlack@google.com>
> >>>
> >>> Make kvm_flush_remote_tlbs_range() visible in common code and create a
> >>> default implementation that just invalidates the whole TLB.
> >>>
> >>> This paves the way for several future features/cleanups:
> >>>
> >>> - Introduction of range-based TLBI on ARM.
> >>> - Eliminating kvm_arch_flush_remote_tlbs_memslot()
> >>> - Moving the KVM/x86 TDP MMU to common code.
> >>>
> >>> No functional change intended.
> >>>
> >>> Signed-off-by: David Matlack <dmatlack@google.com>
> >>> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> >>> Reviewed-by: Gavin Shan <gshan@redhat.com>
> >>> ---
> >>> arch/x86/include/asm/kvm_host.h | 3 +++
> >>> arch/x86/kvm/mmu/mmu.c | 9 ++++-----
> >>> arch/x86/kvm/mmu/mmu_internal.h | 3 ---
> >>> include/linux/kvm_host.h | 9 +++++++++
> >>> virt/kvm/kvm_main.c | 13 +++++++++++++
> >>> 5 files changed, 29 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> >>> index a2d3cfc2eb75..08900afbf2ad 100644
> >>> --- a/arch/x86/include/asm/kvm_host.h
> >>> +++ b/arch/x86/include/asm/kvm_host.h
> >>> @@ -1804,6 +1804,9 @@ static inline int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
> >>> return -ENOTSUPP;
> >>> }
> >>>
> >>> +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
> >>> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages);
> >>> +
> >>> #define kvm_arch_pmi_in_guest(vcpu) \
> >>> ((vcpu) && (vcpu)->arch.handling_intr_from_guest)
> >>>
> >>> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> >>> index ec169f5c7dce..aaa5e336703a 100644
> >>> --- a/arch/x86/kvm/mmu/mmu.c
> >>> +++ b/arch/x86/kvm/mmu/mmu.c
> >>> @@ -278,16 +278,15 @@ static inline bool kvm_available_flush_remote_tlbs_range(void)
> >>> return kvm_x86_ops.flush_remote_tlbs_range;
> >>> }
> >>>
> >>> -void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn,
> >>> - gfn_t nr_pages)
> >>> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages)
> >>> {
> >>> int ret = -EOPNOTSUPP;
> >>>
> >>> if (kvm_x86_ops.flush_remote_tlbs_range)
> >>> ret = static_call(kvm_x86_flush_remote_tlbs_range)(kvm, start_gfn,
> >>> - nr_pages);
> >>> - if (ret)
> >>> - kvm_flush_remote_tlbs(kvm);
> >>> + pages);
> >> This will be good if parameter pages aligned with parameter kvm.
> >>
> > Agreed, but pulling 'pages' above brings the char count to 83. If
> > that's acceptable, I'm happy to do it in v7.
> > Hi Raghavendra,
>
> no need to pulling 'pages' above, just delete one tab, and add some
> space before the pages, just like the original `nr_pages` position.
>
Oh yes, that can be done. Thanks!
- Raghavendra
> Thanks,
> Shaoqin
> > Thank you.
> > Raghavendra
> >> Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> >>> +
> >>> + return ret;
> >>> }
> >>>
> >>> static gfn_t kvm_mmu_page_get_gfn(struct kvm_mmu_page *sp, int index);
> >>> diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
> >>> index d39af5639ce9..86cb83bb3480 100644
> >>> --- a/arch/x86/kvm/mmu/mmu_internal.h
> >>> +++ b/arch/x86/kvm/mmu/mmu_internal.h
> >>> @@ -170,9 +170,6 @@ bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm,
> >>> struct kvm_memory_slot *slot, u64 gfn,
> >>> int min_level);
> >>>
> >>> -void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn,
> >>> - gfn_t nr_pages);
> >>> -
> >>> /* Flush the given page (huge or not) of guest memory. */
> >>> static inline void kvm_flush_remote_tlbs_gfn(struct kvm *kvm, gfn_t gfn, int level)
> >>> {
> >>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> >>> index e3f968b38ae9..a731967b24ff 100644
> >>> --- a/include/linux/kvm_host.h
> >>> +++ b/include/linux/kvm_host.h
> >>> @@ -1359,6 +1359,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target);
> >>> void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool yield_to_kernel_mode);
> >>>
> >>> void kvm_flush_remote_tlbs(struct kvm *kvm);
> >>> +void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages);
> >>>
> >>> #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
> >>> int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min);
> >>> @@ -1486,6 +1487,14 @@ static inline int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
> >>> }
> >>> #endif
> >>>
> >>> +#ifndef __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
> >>> +static inline int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm,
> >>> + gfn_t gfn, u64 pages)
> >>> +{
> >>> + return -EOPNOTSUPP;
> >>> +}
> >>> +#endif
> >>> +
> >>> #ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA
> >>> void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
> >>> void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
> >>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> >>> index d6b050786155..804470fccac7 100644
> >>> --- a/virt/kvm/kvm_main.c
> >>> +++ b/virt/kvm/kvm_main.c
> >>> @@ -366,6 +366,19 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
> >>> }
> >>> EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs);
> >>>
> >>> +void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages)
> >>> +{
> >>> + if (!kvm_arch_flush_remote_tlbs_range(kvm, gfn, pages))
> >>> + return;
> >>> +
> >>> + /*
> >>> + * Fall back to a flushing entire TLBs if the architecture range-based
> >>> + * TLB invalidation is unsupported or can't be performed for whatever
> >>> + * reason.
> >>> + */
> >>> + kvm_flush_remote_tlbs(kvm);
> >>> +}
> >>> +
> >>> static void kvm_flush_shadow_all(struct kvm *kvm)
> >>> {
> >>> kvm_arch_flush_shadow_all(kvm);
> >>
> >> --
> >> Shaoqin
> >>
> >
>
> --
> Shaoqin
>
^ permalink raw reply
* [PATCH] pinctrl: mtmips: do not log when repeating the same pinctrl request
From: Shiji Yang @ 2023-07-18 15:13 UTC (permalink / raw)
To: linux-gpio
Cc: Arınç ÜNAL, Sergio Paracuellos, Sean Wang,
Linus Walleij, Matthias Brugger, AngeloGioacchino Del Regno,
linux-mediatek, linux-mips, Shiji Yang
Sometimes when driver fails to probe a device, the kernel will retry
it later. However, this will result in duplicate requests for the
same pinctrl configuration. In this case, we should not throw error
logs. This patch adds extra check for the pin group function. Now the
pinctrl driver only prints error log when attempting to configure the
same group as different functions.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
drivers/pinctrl/mediatek/pinctrl-mtmips.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtmips.c b/drivers/pinctrl/mediatek/pinctrl-mtmips.c
index efd77b6c5..8f5493220 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtmips.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtmips.c
@@ -125,8 +125,9 @@ static int mtmips_pmx_group_enable(struct pinctrl_dev *pctrldev,
/* dont allow double use */
if (p->groups[group].enabled) {
- dev_err(p->dev, "%s is already enabled\n",
- p->groups[group].name);
+ if (!p->func[func]->enabled)
+ dev_err(p->dev, "%s is already enabled\n",
+ p->groups[group].name);
return 0;
}
--
2.30.2
^ permalink raw reply related
* Re: [PATCH 0/3] MIPS: Fix build issues from the introduction of `need-compiler'
From: Huacai Chen @ 2023-07-18 14:54 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Thomas Bogendoerfer, Jan-Benedict Glaw, Guillaume Tucker,
Huacai Chen, linux-mips, linux-kernel
In-Reply-To: <alpine.DEB.2.21.2307180025120.62448@angie.orcam.me.uk>
Hi, Maciej,
Even if patch-2 resolves the problem, I don't think patch-3 is
necessary because the original patch makes code simpler and more
compact.
Huacai
On Tue, Jul 18, 2023 at 10:42 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> Hi,
>
> With the addition of the `need-compiler' variable the `Makefile.compiler'
> fragment is not included with no-build targets such as `modules_install',
> which in turn means $(call cc-option,), etc. are no-ops with these targets
> and any attempt to evaluate these function calls causes all kinds of weird
> behaviour to happen.
>
> The solution is to avoid making these calls in the first place, as they
> are surely irrelevant where the compiler is not going to be otherwise
> invoked. This small patch series fixes two places known-affected in the
> MIPS Makefile fragment and also included a follow-up revert of an earlier
> misguided attempt. See individual change descriptions for details.
>
> Verified with `decstation_64_defconfig' and `fuloong2e_defconfig' using
> `modules_install'. Please apply.
>
> Maciej
^ permalink raw reply
* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
From: Arnd Bergmann @ 2023-07-18 14:47 UTC (permalink / raw)
To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
linux-hexagon, linux-staging, linux-csky@vger.kernel.org,
Ingo Molnar, Sami Tolvanen, Kees Cook, Paul E. McKenney,
Frederic Weisbecker, Nicholas Piggin, Borislav Petkov, loongarch,
Thomas Gleixner, linux-arm-kernel, x86, linux-kernel,
Juerg Haefliger, linux-alpha, Andrew Morton, linuxppc-dev
In-Reply-To: <150c0fa2-bff2-0644-d6e5-c4dab7f79048@suse.de>
On Wed, Jul 5, 2023, at 10:18, Thomas Zimmermann wrote:
> Am 30.06.23 um 13:53 schrieb Arnd Bergmann:
>> On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:
>>> Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
>>
>> I definitely get it for the screen_info, which needs the complexity.
>> For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
>> anything other than x86, so I would still go with just a dependency
>> on x86 for simplicity, but I don't mind having the extra symbol if that
>> keeps it more consistent with how the screen_info is handled.
>
> Well, I'd like to add edid_info to platforms with EFI. What would be
> arm/arm64 and loongarch, I guess. See below for the future plans.
To be clear: I don't mind using a 'struct edid_info' being passed
around between subsystems, that is clearly an improvement over
'struct screen_info'. It's the global variable that seems like
an artifact of linux-2.4 days, and I think we can do better than that.
>>>> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
>>>> the need for a global edid_info structure, but that would not
>>>> share any code with the current fb_firmware_edid() function.
>>>
>>> The current code is build on top of screen_info and edid_info. I'd
>>> preferably not replace that, if possible.
>>
>> One way I could imagine this looking in the end would be
>> something like
>>
>> struct screen_info *fb_screen_info(struct device *dev)
>> {
>> struct screen_info *si = NULL;
>>
>> if (IS_ENABLED(CONFIG_EFI))
>> si = efi_get_screen_info(dev);
>>
>> if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
>> si = screen_info;
>>
>> return si;
>> }
>>
>> corresponding to fb_firmware_edid(). With this, any driver
>> that wants to access screen_info would call this function
>> instead of using the global pointer, plus either NULL pointer
>> check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.
>>
>> This way we could completely eliminate the global screen_info
>> on arm64, riscv, and loongarch but still use the efi and
>> hyperv framebuffer/drm drivers.
>
> If possible, I'd like to remove global screen_info and edid_info
> entirely from fbdev and the various consoles.
ok
> We currently use screen_info to set up the generic framebuffer device in
> drivers/firmware/sysfb.c. I'd like to use edid_info here as well, so
> that the generic graphics drivers can get EDID information.
>
> For the few fbdev drivers and consoles that require the global
> screen_info/edid_info, I'd rather provide lookup functions in sysfb
> (e.g., sysfb_get_screen_info(), sysfb_get_edid_info()). The global
> screen_info/edid_info state would then become an internal artifact of
> the sysfb code.
>
> Hopefully that explains some of the decisions made in this patchset.
I spent some more time looking at the screen_info side, after my
first set of patches to refine the #ifdefs, and I think we don't
even need to make screen_info available to non-x86 drivers at all:
- All the vgacon users except for x86 can just register a static
screen_info (or simplified into a simpler structure) with the
driver itself. This even includes ia64, which does not support
EFI framebuffers.
- The VESA, vga16, SIS, Intel and HyperV framebuffer drivers only
need access to screen_info on x86. HyperV is the only driver that
can currently access the data from EFI firmware on arm64, but
that is only used for 'gen 1' guests, which I'm pretty sure
only exist on x86.
- All the other references to screen_info are specific to EFI
firmware, so we can move the global definition from arm,
arm64, loongarch, riscv and ia64 into the EFI firmware
code itself. It is still accessed by efifb and efi-earlycon
at this point.
I have uploaded version 2 of my series to
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=screen-info-v2
and will send it out after I get the green light from build
bots.
Arnd
^ permalink raw reply
* Re: [PATCH 2/3] MIPS: Only fiddle with CHECKFLAGS if `need-compiler'
From: Guillaume Tucker @ 2023-07-18 14:45 UTC (permalink / raw)
To: Maciej W. Rozycki, Thomas Bogendoerfer
Cc: Jan-Benedict Glaw, Huacai Chen, linux-mips, linux-kernel,
Collabora Kernel ML
In-Reply-To: <alpine.DEB.2.21.2307181421010.61566@angie.orcam.me.uk>
Please also mention the KernelCI bot as this was initially found
thanks to an automated email report:
On 18/07/2023 16:37, Maciej W. Rozycki wrote:
> Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Thanks,
Guillaume
^ permalink raw reply
* Re: [PATCH V2] MIPS: Loongson: Fix build error when make modules_install
From: Maciej W. Rozycki @ 2023-07-18 14:43 UTC (permalink / raw)
To: Huacai Chen
Cc: Thomas Bogendoerfer, Huacai Chen, linux-mips, Jiaxun Yang, stable,
Feiyang Chen, Nathan Chancellor, Nick Desaulniers
In-Reply-To: <20230628110847.3168269-1-chenhuacai@loongson.cn>
On Wed, 28 Jun 2023, Huacai Chen wrote:
> After commit 0e96ea5c3eb5904e5dc2f ("MIPS: Loongson64: Clean up use of
> cc-ifversion") we get a build error when make modules_install:
>
> cc1: error: '-mloongson-mmi' must be used with '-mhard-float'
>
> The reason is when make modules_install, 'call cc-option' doesn't work
> in $(KBUILD_CFLAGS) of 'CHECKFLAGS'. Then there is no -mno-loongson-mmi
> applied and -march=loongson3a enable MMI instructions.
That's the wrong fix, you've just papered over the actual problem in a
needlessly complex way.
The right fix is not to define CHECKFLAGS unless `need-compiler' -- we
don't need CHECKFLAGS when we aren't going to use the compiler, in which
case Makefile.compiler is not sourced, as discussed here:
<https://lore.kernel.org/r/20230204145641.66417-1-alobakin@mailbox.org/>
and here:
<https://lore.kernel.org/r/alpine.DEB.2.21.2302071942200.11790@angie.orcam.me.uk/>.
I guess nobody bothers reading such discussions though, hence the most
obvious fixes are ignored.
I've posted proper fixes now:
<https://lore.kernel.org/r/alpine.DEB.2.21.2307180025120.62448@angie.orcam.me.uk/>.
Maciej
^ permalink raw reply
* [PATCH 3/3] Revert MIPS: Loongson: Fix build error when make modules_install
From: Maciej W. Rozycki @ 2023-07-18 14:37 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Jan-Benedict Glaw, Guillaume Tucker, Huacai Chen, linux-mips,
linux-kernel
In-Reply-To: <alpine.DEB.2.21.2307180025120.62448@angie.orcam.me.uk>
Revert commit 531b3d1195d0 ("MIPS: Loongson: Fix build error when make
modules_install"), which made `-march=loongson2e', `-march=loongson2f',
and `-march=loongson3a' compilation options probed for even though GCC
has supported them since 4.4.0, 4.4.0, and 4.6.0 respectively, which is
below our current minimum requirement of 5.1, in an attempt to work
around for the `cc-option' `make' function being undefined with `make'
targets that do not use the compiler. The workaround has now been made
obsolete, by querying the `need-compiler' variable instead so as to make
sure the compiler isn't called for non-build targets.
Verified with `fuloong2e_defconfig' and the `modules_install' target.
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
---
arch/mips/Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Index: linux-macro/arch/mips/Makefile
===================================================================
--- linux-macro.orig/arch/mips/Makefile
+++ linux-macro/arch/mips/Makefile
@@ -181,12 +181,16 @@ endif
cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2E) += $(call cc-option,-march=loongson2e) -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON2F) += $(call cc-option,-march=loongson2f) -Wa,--trap
-cflags-$(CONFIG_CPU_LOONGSON64) += $(call cc-option,-march=loongson3a,-march=mips64r2) -Wa,--trap
+cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e -Wa,--trap
+cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap
# Some -march= flags enable MMI instructions, and GCC complains about that
# support being enabled alongside -msoft-float. Thus explicitly disable MMI.
cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-mno-loongson-mmi)
+ifdef CONFIG_CPU_LOONGSON64
+cflags-$(CONFIG_CPU_LOONGSON64) += -Wa,--trap
+cflags-$(CONFIG_CC_IS_GCC) += -march=loongson3a
+cflags-$(CONFIG_CC_IS_CLANG) += -march=mips64r2
+endif
cflags-$(CONFIG_CPU_LOONGSON64) += $(call cc-option,-mno-loongson-mmi)
cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
^ permalink raw reply
* [PATCH 2/3] MIPS: Only fiddle with CHECKFLAGS if `need-compiler'
From: Maciej W. Rozycki @ 2023-07-18 14:37 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Jan-Benedict Glaw, Guillaume Tucker, Huacai Chen, linux-mips,
linux-kernel
In-Reply-To: <alpine.DEB.2.21.2307180025120.62448@angie.orcam.me.uk>
We have originally guarded fiddling with CHECKFLAGS in our arch Makefile
by checking for the CONFIG_MIPS variable, not set for targets such as
`distclean', etc. that neither include `.config' nor use the compiler.
Starting from commit 805b2e1d427a ("kbuild: include Makefile.compiler
only when compiler is needed") we have had a generic `need-compiler'
variable explicitly telling us if the compiler will be used and thus its
capabilities need to be checked and expressed in the form of compilation
flags. If this variable is not set, then `make' functions such as
`cc-option' are undefined, causing all kinds of weirdness to happen if
we expect specific results to be returned, most recently:
cc1: error: '-mloongson-mmi' must be used with '-mhard-float'
messages with configurations such as `fuloong2e_defconfig' and the
`modules_install' target, which does include `.config' and yet does not
use the compiler.
Replace the check for CONFIG_MIPS with one for `need-compiler' instead,
so as to prevent the compiler from being ever called for CHECKFLAGS when
not needed.
Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Closes: https://lore.kernel.org/r/85031c0c-d981-031e-8a50-bc4fad2ddcd8@collabora.com/
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed")
Cc: stable@vger.kernel.org # v5.13+
---
arch/mips/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
linux-mips-checkflags-need-compiler.diff
Index: linux-macro/arch/mips/Makefile
===================================================================
--- linux-macro.orig/arch/mips/Makefile
+++ linux-macro/arch/mips/Makefile
@@ -341,7 +341,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin
KBUILD_LDFLAGS += -m $(ld-emul)
-ifdef CONFIG_MIPS
+ifdef need-compiler
CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
^ permalink raw reply
* [PATCH 1/3] MIPS: Fix CONFIG_CPU_DADDI_WORKAROUNDS `modules_install' regression
From: Maciej W. Rozycki @ 2023-07-18 14:37 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Jan-Benedict Glaw, Guillaume Tucker, Huacai Chen, linux-mips,
linux-kernel
In-Reply-To: <alpine.DEB.2.21.2307180025120.62448@angie.orcam.me.uk>
Remove a build-time check for the presence of the GCC `-msym32' option.
This option has been there since GCC 4.1.0, which is below the minimum
required as at commit 805b2e1d427a ("kbuild: include Makefile.compiler
only when compiler is needed"), when an error message:
arch/mips/Makefile:306: *** CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32. Stop.
started to trigger for the `modules_install' target with configurations
such as `decstation_64_defconfig' that set CONFIG_CPU_DADDI_WORKAROUNDS,
because said commit has made `cc-option-yn' an undefined function for
non-build targets.
Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed")
Cc: stable@vger.kernel.org # v5.13+
---
arch/mips/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
linux-mips-msym32-uncond.diff
Index: linux-macro/arch/mips/Makefile
===================================================================
--- linux-macro.orig/arch/mips/Makefile
+++ linux-macro/arch/mips/Makefile
@@ -299,8 +299,8 @@ ifdef CONFIG_64BIT
endif
endif
- ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
- cflags-y += -msym32 -DKBUILD_64BIT_SYM32
+ ifeq ($(KBUILD_SYM32), y)
+ cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32
else
ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
$(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
^ permalink raw reply
* [PATCH 0/3] MIPS: Fix build issues from the introduction of `need-compiler'
From: Maciej W. Rozycki @ 2023-07-18 14:37 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Jan-Benedict Glaw, Guillaume Tucker, Huacai Chen, linux-mips,
linux-kernel
Hi,
With the addition of the `need-compiler' variable the `Makefile.compiler'
fragment is not included with no-build targets such as `modules_install',
which in turn means $(call cc-option,), etc. are no-ops with these targets
and any attempt to evaluate these function calls causes all kinds of weird
behaviour to happen.
The solution is to avoid making these calls in the first place, as they
are surely irrelevant where the compiler is not going to be otherwise
invoked. This small patch series fixes two places known-affected in the
MIPS Makefile fragment and also included a follow-up revert of an earlier
misguided attempt. See individual change descriptions for details.
Verified with `decstation_64_defconfig' and `fuloong2e_defconfig' using
`modules_install'. Please apply.
Maciej
^ permalink raw reply
* [PATCH v2] usb: Explicitly include correct DT includes
From: Rob Herring @ 2023-07-18 14:30 UTC (permalink / raw)
To: Peter Chen, Pawel Laszczak, Roger Quadros, Aswath Govindraju,
Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Thierry Reding, Jonathan Hunter, Minas Harutyunyan, Thinh Nguyen,
Li Yang, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Herve Codina, Michal Simek, Alan Stern, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Mathias Nyman, Richard Leitner,
Chunfeng Yun, Paul Cercueil, Bin Liu, Conor Dooley,
Daire McNamara, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Guenter Roeck, Heikki Krogerus, Bryan O'Donoghue, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: devicetree, linux-usb, linux-kernel, linux-arm-kernel,
linux-tegra, linuxppc-dev, linux-renesas-soc, linux-mediatek,
linux-mips, linux-riscv, linux-sunxi, linux-arm-msm
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.
Acked-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
v2:
- Fix double include of of.h
---
drivers/usb/cdns3/cdns3-gadget.c | 1 +
drivers/usb/cdns3/cdns3-plat.c | 1 +
drivers/usb/cdns3/cdns3-ti.c | 1 +
drivers/usb/cdns3/core.c | 1 +
drivers/usb/chipidea/ci_hdrc_imx.c | 1 +
drivers/usb/chipidea/ci_hdrc_tegra.c | 3 ++-
drivers/usb/chipidea/usbmisc_imx.c | 3 ++-
drivers/usb/common/common.c | 1 +
drivers/usb/core/message.c | 1 +
drivers/usb/core/of.c | 1 -
drivers/usb/core/usb.c | 1 +
drivers/usb/dwc2/gadget.c | 1 -
drivers/usb/dwc2/platform.c | 2 +-
drivers/usb/dwc3/dwc3-imx8mp.c | 1 +
drivers/usb/dwc3/dwc3-keystone.c | 1 +
drivers/usb/gadget/udc/fsl_udc_core.c | 1 -
drivers/usb/gadget/udc/gr_udc.c | 5 ++---
drivers/usb/gadget/udc/max3420_udc.c | 4 +---
drivers/usb/gadget/udc/pxa27x_udc.c | 2 +-
drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
drivers/usb/gadget/udc/renesas_usbf.c | 5 ++---
drivers/usb/gadget/udc/tegra-xudc.c | 1 -
drivers/usb/gadget/udc/udc-xilinx.c | 6 ++----
drivers/usb/host/ehci-fsl.c | 2 +-
drivers/usb/host/ehci-orion.c | 2 --
drivers/usb/host/fhci-hcd.c | 3 ++-
drivers/usb/host/fsl-mph-dr-of.c | 3 ++-
drivers/usb/host/ohci-at91.c | 2 +-
drivers/usb/host/ohci-da8xx.c | 1 +
drivers/usb/host/ohci-ppc-of.c | 3 ++-
drivers/usb/host/xhci-plat.c | 1 -
drivers/usb/host/xhci-rcar.c | 1 -
drivers/usb/host/xhci-tegra.c | 2 +-
drivers/usb/misc/usb251xb.c | 2 +-
drivers/usb/mtu3/mtu3.h | 1 +
drivers/usb/mtu3/mtu3_host.c | 1 +
drivers/usb/musb/jz4740.c | 2 +-
drivers/usb/musb/mediatek.c | 1 +
drivers/usb/musb/mpfs.c | 1 +
drivers/usb/musb/musb_dsps.c | 2 --
drivers/usb/musb/sunxi.c | 1 -
drivers/usb/phy/phy-mxs-usb.c | 2 +-
drivers/usb/phy/phy-tegra-usb.c | 2 +-
drivers/usb/renesas_usbhs/common.c | 2 +-
drivers/usb/renesas_usbhs/rza.c | 2 +-
drivers/usb/renesas_usbhs/rza2.c | 1 -
drivers/usb/typec/tcpm/fusb302.c | 2 +-
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 2 +-
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 2 --
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 -
drivers/usb/typec/ucsi/ucsi_glink.c | 1 -
51 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index ea19253fd2d0..e6f6aeb7b5bb 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -61,6 +61,7 @@
#include <linux/module.h>
#include <linux/dmapool.h>
#include <linux/iopoll.h>
+#include <linux/property.h>
#include "core.h"
#include "gadget-export.h"
diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index 884e2301237f..b15ff5bd91c2 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/irq.h>
#include <linux/kernel.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 81b9132e3aaa..5945c4b1e11f 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -15,6 +15,7 @@
#include <linux/io.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
/* USB Wrapper register offsets */
#define USBSS_PID 0x0
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index dbcdf3b24b47..baa154cee352 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -14,6 +14,7 @@
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/io.h>
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 336ef6dd8e7d..aa2aebed8e2d 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -6,6 +6,7 @@
*/
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
index ca36d11a69ea..8e78bf643e25 100644
--- a/drivers/usb/chipidea/ci_hdrc_tegra.c
+++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
@@ -6,7 +6,8 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 9ee9621e2ccc..e8a712e5abad 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -4,10 +4,11 @@
*/
#include <linux/module.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/delay.h>
+#include <linux/platform_device.h>
#include <linux/usb/otg.h>
#include "ci_hdrc_imx.h"
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index c9bdeb4ddcb5..b84efae26e15 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/platform_device.h>
#include <linux/usb/ch9.h>
#include <linux/usb/of.h>
#include <linux/usb/otg.h>
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b5811620f1de..0d2bfc909019 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -9,6 +9,7 @@
#include <linux/pci.h> /* for scatterlist macros */
#include <linux/usb.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/timer.h>
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c
index 617e92569b2c..db4ccf9ce3d9 100644
--- a/drivers/usb/core/of.c
+++ b/drivers/usb/core/of.c
@@ -8,7 +8,6 @@
*/
#include <linux/of.h>
-#include <linux/of_platform.h>
#include <linux/usb/of.h>
/**
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 901ec732321c..396a338d801e 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/of.h>
#include <linux/string.h>
#include <linux/bitops.h>
#include <linux/slab.h>
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8b15742d9e8a..b517a7216de2 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -22,7 +22,6 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
-#include <linux/of_platform.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 0a806f80217e..b1d48019e944 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -11,7 +11,7 @@
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/phy/phy.h>
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index 8b9a3bb587bf..4285bde58d2e 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -10,6 +10,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
index 0a09aedc2573..4155e8d5a559 100644
--- a/drivers/usb/dwc3/dwc3-keystone.c
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -13,6 +13,7 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index a67873a074b7..5265ca418cde 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -36,7 +36,6 @@
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
#include <linux/dmapool.h>
-#include <linux/of_device.h>
#include <asm/byteorder.h>
#include <asm/io.h>
diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index 09762559912d..0c3969301a53 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -23,6 +23,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
@@ -36,9 +37,7 @@
#include <linux/dmapool.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
-#include <linux/of_platform.h>
-#include <linux/of_irq.h>
-#include <linux/of_address.h>
+#include <linux/of.h>
#include <asm/byteorder.h>
diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c
index 12c519f32bf7..2d57786d3db7 100644
--- a/drivers/usb/gadget/udc/max3420_udc.c
+++ b/drivers/usb/gadget/udc/max3420_udc.c
@@ -19,9 +19,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/bitfield.h>
-#include <linux/of_address.h>
-#include <linux/of_device.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/prefetch.h>
#include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index c4e1d957f913..61424cfd2e1c 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -23,7 +23,7 @@
#include <linux/prefetch.h>
#include <linux/byteorder/generic.h>
#include <linux/platform_data/pxa2xx_udc.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/usb.h>
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 59bb25de2015..3b01734ce1b7 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -14,7 +14,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c
index 6cd0af83e91e..3482b41d0646 100644
--- a/drivers/usb/gadget/udc/renesas_usbf.c
+++ b/drivers/usb/gadget/udc/renesas_usbf.c
@@ -12,10 +12,9 @@
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/types.h>
#include <linux/usb/composite.h>
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 83eaa65ddde3..065046f1c9cb 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -16,7 +16,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/phy/tegra/xusb.h>
#include <linux/pm_domain.h>
diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
index a4a7b90a97e7..0a025bf14e06 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -18,10 +18,8 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_device.h>
-#include <linux/of_platform.h>
-#include <linux/of_irq.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
#include <linux/prefetch.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 81d60a695510..3c776f4de4b8 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -22,7 +22,7 @@
#include <linux/usb/otg.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
#include <linux/io.h>
#include "ehci.h"
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 2cfb27dc943a..a5f4e2f98346 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -13,8 +13,6 @@
#include <linux/platform_data/usb-ehci-orion.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
-#include <linux/of_device.h>
-#include <linux/of_irq.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include <linux/io.h>
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 66a045e01dad..9a1b5224f239 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -22,9 +22,10 @@
#include <linux/io.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
+#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
-#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include <soc/fsl/qe/qe.h>
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index a9877f2569f4..8508d37a2aff 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -10,7 +10,8 @@
#include <linux/fsl_devices.h>
#include <linux/err.h>
#include <linux/io.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index b9ce8d80f20b..3b023ea71f8d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -17,13 +17,13 @@
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/gpio/consumer.h>
-#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/platform_data/atmel.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mfd/syscon.h>
+#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index e4191a868944..9bd6cb9af364 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -15,6 +15,7 @@
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/phy/phy.h>
#include <linux/platform_data/usb-davinci.h>
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 35a7ad7e2569..f64bfe5f4d4d 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -15,9 +15,10 @@
*/
#include <linux/signal.h>
+#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
-#include <linux/of_platform.h>
+#include <linux/platform_device.h>
static int
ohci_ppc_of_start(struct usb_hcd *hcd)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index b26ea7cb4357..28218c8f1837 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -13,7 +13,6 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/usb/phy.h>
#include <linux/slab.h>
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index bf5261fed32c..ab9c5969e462 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -10,7 +10,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/usb/phy.h>
#include "xhci.h"
diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 6ca8a37e53e1..51e236c1ff71 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -14,7 +14,7 @@
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/phy/phy.h>
#include <linux/phy/tegra/xusb.h>
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index e4edb486b69e..7da404f55a6d 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -16,7 +16,7 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/nls.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index b4a7662dded5..c11840b9a6f1 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -16,6 +16,7 @@
#include <linux/extcon.h>
#include <linux/interrupt.h>
#include <linux/list.h>
+#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/regulator/consumer.h>
#include <linux/usb.h>
diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c
index 177d2caf887c..9f2be22af844 100644
--- a/drivers/usb/mtu3/mtu3_host.c
+++ b/drivers/usb/mtu3/mtu3_host.c
@@ -11,6 +11,7 @@
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/regmap.h>
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 5aabdd7e2511..b38df9226278 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -10,7 +10,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/usb/role.h>
diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
index 598ee5c0bf34..0a35aab3ab81 100644
--- a/drivers/usb/musb/mediatek.c
+++ b/drivers/usb/musb/mediatek.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/usb/role.h>
diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 24b98716f7fc..f0f56df38835 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -13,6 +13,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/usb/usb_phy_generic.h>
#include "musb_core.h"
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 9119b1d51370..98b42dc04dee 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -26,9 +26,7 @@
#include <linux/sizes.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/of_address.h>
-#include <linux/of_irq.h>
#include <linux/usb/of.h>
#include <linux/debugfs.h>
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index c5c6c4e09300..d54283fd026b 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -15,7 +15,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/phy/phy-sun4i-usb.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index e1a2b2ea098b..50cf0003384a 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -14,7 +14,7 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/iopoll.h>
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 8b2ff3a8882d..4ea47e6f835b 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -16,7 +16,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/slab.h>
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 111b7ee152c4..dd1c17542439 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -11,7 +11,7 @@
#include <linux/gpio/consumer.h>
#include <linux/io.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/slab.h>
diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c
index 2d77edefb4b3..97b5217c5a90 100644
--- a/drivers/usb/renesas_usbhs/rza.c
+++ b/drivers/usb/renesas_usbhs/rza.c
@@ -8,7 +8,7 @@
#include <linux/delay.h>
#include <linux/io.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include "common.h"
#include "rza.h"
diff --git a/drivers/usb/renesas_usbhs/rza2.c b/drivers/usb/renesas_usbhs/rza2.c
index 3eed3334a17f..f079817250bb 100644
--- a/drivers/usb/renesas_usbhs/rza2.c
+++ b/drivers/usb/renesas_usbhs/rza2.c
@@ -8,7 +8,6 @@
#include <linux/delay.h>
#include <linux/io.h>
-#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include "common.h"
#include "rza.h"
diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 7fc1ffa14f76..bc21006e979c 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -15,7 +15,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
#include <linux/proc_fs.h>
#include <linux/regulator/consumer.h>
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
index a905160dd860..f2f3601cbbfb 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
@@ -8,7 +8,7 @@
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
index 4e1b846627d2..bb0b8479d80f 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
@@ -8,8 +8,6 @@
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of_device.h>
-#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
index 94285f64b67d..fdd916292675 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
@@ -9,7 +9,6 @@
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 1fe9cb5b6bd9..bb1854b3311d 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -5,7 +5,6 @@
*/
#include <linux/auxiliary_bus.h>
#include <linux/module.h>
-#include <linux/of_device.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/soc/qcom/pdr.h>
--
2.40.1
^ permalink raw reply related
* [PATCH] MIPS: Loongson64: Fix more __iomem attributes
From: Jiaxun Yang @ 2023-07-18 13:44 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, chenhuacai, Jiaxun Yang, kernel test robot
There are some __iomem type casting being missed in previous patch.
Fix them here.
Fixes: 5bd3990723bd ("MIPS: Loongson64: Prefix ipi register address pointers with __iomem")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307020639.QCZOKp8B-lkp@intel.com/
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/loongson64/smp.c | 168 ++++++++++++++++++-------------------
1 file changed, 84 insertions(+), 84 deletions(-)
diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index cdecd7af11a6..b700ca887c35 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -187,181 +187,181 @@ static void csr_ipi_probe(void)
static void ipi_set0_regs_init(void)
{
- ipi_set0_regs[0] = (void *)
+ ipi_set0_regs[0] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + SET0);
- ipi_set0_regs[1] = (void *)
+ ipi_set0_regs[1] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + SET0);
- ipi_set0_regs[2] = (void *)
+ ipi_set0_regs[2] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + SET0);
- ipi_set0_regs[3] = (void *)
+ ipi_set0_regs[3] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + SET0);
- ipi_set0_regs[4] = (void *)
+ ipi_set0_regs[4] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + SET0);
- ipi_set0_regs[5] = (void *)
+ ipi_set0_regs[5] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + SET0);
- ipi_set0_regs[6] = (void *)
+ ipi_set0_regs[6] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + SET0);
- ipi_set0_regs[7] = (void *)
+ ipi_set0_regs[7] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + SET0);
- ipi_set0_regs[8] = (void *)
+ ipi_set0_regs[8] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + SET0);
- ipi_set0_regs[9] = (void *)
+ ipi_set0_regs[9] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + SET0);
- ipi_set0_regs[10] = (void *)
+ ipi_set0_regs[10] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + SET0);
- ipi_set0_regs[11] = (void *)
+ ipi_set0_regs[11] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + SET0);
- ipi_set0_regs[12] = (void *)
+ ipi_set0_regs[12] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + SET0);
- ipi_set0_regs[13] = (void *)
+ ipi_set0_regs[13] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + SET0);
- ipi_set0_regs[14] = (void *)
+ ipi_set0_regs[14] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + SET0);
- ipi_set0_regs[15] = (void *)
+ ipi_set0_regs[15] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + SET0);
}
static void ipi_clear0_regs_init(void)
{
- ipi_clear0_regs[0] = (void *)
+ ipi_clear0_regs[0] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + CLEAR0);
- ipi_clear0_regs[1] = (void *)
+ ipi_clear0_regs[1] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + CLEAR0);
- ipi_clear0_regs[2] = (void *)
+ ipi_clear0_regs[2] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + CLEAR0);
- ipi_clear0_regs[3] = (void *)
+ ipi_clear0_regs[3] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + CLEAR0);
- ipi_clear0_regs[4] = (void *)
+ ipi_clear0_regs[4] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + CLEAR0);
- ipi_clear0_regs[5] = (void *)
+ ipi_clear0_regs[5] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + CLEAR0);
- ipi_clear0_regs[6] = (void *)
+ ipi_clear0_regs[6] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + CLEAR0);
- ipi_clear0_regs[7] = (void *)
+ ipi_clear0_regs[7] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + CLEAR0);
- ipi_clear0_regs[8] = (void *)
+ ipi_clear0_regs[8] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + CLEAR0);
- ipi_clear0_regs[9] = (void *)
+ ipi_clear0_regs[9] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + CLEAR0);
- ipi_clear0_regs[10] = (void *)
+ ipi_clear0_regs[10] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + CLEAR0);
- ipi_clear0_regs[11] = (void *)
+ ipi_clear0_regs[11] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + CLEAR0);
- ipi_clear0_regs[12] = (void *)
+ ipi_clear0_regs[12] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + CLEAR0);
- ipi_clear0_regs[13] = (void *)
+ ipi_clear0_regs[13] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + CLEAR0);
- ipi_clear0_regs[14] = (void *)
+ ipi_clear0_regs[14] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + CLEAR0);
- ipi_clear0_regs[15] = (void *)
+ ipi_clear0_regs[15] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + CLEAR0);
}
static void ipi_status0_regs_init(void)
{
- ipi_status0_regs[0] = (void *)
+ ipi_status0_regs[0] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + STATUS0);
- ipi_status0_regs[1] = (void *)
+ ipi_status0_regs[1] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + STATUS0);
- ipi_status0_regs[2] = (void *)
+ ipi_status0_regs[2] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + STATUS0);
- ipi_status0_regs[3] = (void *)
+ ipi_status0_regs[3] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + STATUS0);
- ipi_status0_regs[4] = (void *)
+ ipi_status0_regs[4] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + STATUS0);
- ipi_status0_regs[5] = (void *)
+ ipi_status0_regs[5] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + STATUS0);
- ipi_status0_regs[6] = (void *)
+ ipi_status0_regs[6] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + STATUS0);
- ipi_status0_regs[7] = (void *)
+ ipi_status0_regs[7] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + STATUS0);
- ipi_status0_regs[8] = (void *)
+ ipi_status0_regs[8] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + STATUS0);
- ipi_status0_regs[9] = (void *)
+ ipi_status0_regs[9] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + STATUS0);
- ipi_status0_regs[10] = (void *)
+ ipi_status0_regs[10] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + STATUS0);
- ipi_status0_regs[11] = (void *)
+ ipi_status0_regs[11] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + STATUS0);
- ipi_status0_regs[12] = (void *)
+ ipi_status0_regs[12] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + STATUS0);
- ipi_status0_regs[13] = (void *)
+ ipi_status0_regs[13] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + STATUS0);
- ipi_status0_regs[14] = (void *)
+ ipi_status0_regs[14] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + STATUS0);
- ipi_status0_regs[15] = (void *)
+ ipi_status0_regs[15] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + STATUS0);
}
static void ipi_en0_regs_init(void)
{
- ipi_en0_regs[0] = (void *)
+ ipi_en0_regs[0] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + EN0);
- ipi_en0_regs[1] = (void *)
+ ipi_en0_regs[1] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + EN0);
- ipi_en0_regs[2] = (void *)
+ ipi_en0_regs[2] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + EN0);
- ipi_en0_regs[3] = (void *)
+ ipi_en0_regs[3] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + EN0);
- ipi_en0_regs[4] = (void *)
+ ipi_en0_regs[4] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + EN0);
- ipi_en0_regs[5] = (void *)
+ ipi_en0_regs[5] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + EN0);
- ipi_en0_regs[6] = (void *)
+ ipi_en0_regs[6] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + EN0);
- ipi_en0_regs[7] = (void *)
+ ipi_en0_regs[7] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + EN0);
- ipi_en0_regs[8] = (void *)
+ ipi_en0_regs[8] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + EN0);
- ipi_en0_regs[9] = (void *)
+ ipi_en0_regs[9] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + EN0);
- ipi_en0_regs[10] = (void *)
+ ipi_en0_regs[10] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + EN0);
- ipi_en0_regs[11] = (void *)
+ ipi_en0_regs[11] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + EN0);
- ipi_en0_regs[12] = (void *)
+ ipi_en0_regs[12] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + EN0);
- ipi_en0_regs[13] = (void *)
+ ipi_en0_regs[13] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + EN0);
- ipi_en0_regs[14] = (void *)
+ ipi_en0_regs[14] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + EN0);
- ipi_en0_regs[15] = (void *)
+ ipi_en0_regs[15] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + EN0);
}
static void ipi_mailbox_buf_init(void)
{
- ipi_mailbox_buf[0] = (void *)
+ ipi_mailbox_buf[0] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE0_OFFSET + BUF);
- ipi_mailbox_buf[1] = (void *)
+ ipi_mailbox_buf[1] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE1_OFFSET + BUF);
- ipi_mailbox_buf[2] = (void *)
+ ipi_mailbox_buf[2] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE2_OFFSET + BUF);
- ipi_mailbox_buf[3] = (void *)
+ ipi_mailbox_buf[3] = (void __iomem *)
(SMP_CORE_GROUP0_BASE + SMP_CORE3_OFFSET + BUF);
- ipi_mailbox_buf[4] = (void *)
+ ipi_mailbox_buf[4] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE0_OFFSET + BUF);
- ipi_mailbox_buf[5] = (void *)
+ ipi_mailbox_buf[5] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE1_OFFSET + BUF);
- ipi_mailbox_buf[6] = (void *)
+ ipi_mailbox_buf[6] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE2_OFFSET + BUF);
- ipi_mailbox_buf[7] = (void *)
+ ipi_mailbox_buf[7] = (void __iomem *)
(SMP_CORE_GROUP1_BASE + SMP_CORE3_OFFSET + BUF);
- ipi_mailbox_buf[8] = (void *)
+ ipi_mailbox_buf[8] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE0_OFFSET + BUF);
- ipi_mailbox_buf[9] = (void *)
+ ipi_mailbox_buf[9] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE1_OFFSET + BUF);
- ipi_mailbox_buf[10] = (void *)
+ ipi_mailbox_buf[10] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE2_OFFSET + BUF);
- ipi_mailbox_buf[11] = (void *)
+ ipi_mailbox_buf[11] = (void __iomem *)
(SMP_CORE_GROUP2_BASE + SMP_CORE3_OFFSET + BUF);
- ipi_mailbox_buf[12] = (void *)
+ ipi_mailbox_buf[12] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE0_OFFSET + BUF);
- ipi_mailbox_buf[13] = (void *)
+ ipi_mailbox_buf[13] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE1_OFFSET + BUF);
- ipi_mailbox_buf[14] = (void *)
+ ipi_mailbox_buf[14] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE2_OFFSET + BUF);
- ipi_mailbox_buf[15] = (void *)
+ ipi_mailbox_buf[15] = (void __iomem *)
(SMP_CORE_GROUP3_BASE + SMP_CORE3_OFFSET + BUF);
}
@@ -782,7 +782,7 @@ void play_dead(void)
if (prid_imp == PRID_IMP_LOONGSON_64G) {
play_dead_at_ckseg1 =
- (void *)CKSEG1ADDR((unsigned long)loongson3_type3_play_dead);
+ (void __iomem *)CKSEG1ADDR((unsigned long)loongson3_type3_play_dead);
goto out;
}
@@ -790,19 +790,19 @@ void play_dead(void)
case PRID_REV_LOONGSON3A_R1:
default:
play_dead_at_ckseg1 =
- (void *)CKSEG1ADDR((unsigned long)loongson3_type1_play_dead);
+ (void __iomem *)CKSEG1ADDR((unsigned long)loongson3_type1_play_dead);
break;
case PRID_REV_LOONGSON3B_R1:
case PRID_REV_LOONGSON3B_R2:
play_dead_at_ckseg1 =
- (void *)CKSEG1ADDR((unsigned long)loongson3_type2_play_dead);
+ (void __iomem *)CKSEG1ADDR((unsigned long)loongson3_type2_play_dead);
break;
case PRID_REV_LOONGSON3A_R2_0:
case PRID_REV_LOONGSON3A_R2_1:
case PRID_REV_LOONGSON3A_R3_0:
case PRID_REV_LOONGSON3A_R3_1:
play_dead_at_ckseg1 =
- (void *)CKSEG1ADDR((unsigned long)loongson3_type3_play_dead);
+ (void __iomem *)CKSEG1ADDR((unsigned long)loongson3_type3_play_dead);
break;
}
--
2.39.2
^ permalink raw reply related
* Re: [PATCH v6 10/11] KVM: arm64: Invalidate the table entries upon a range
From: Shaoqin Huang @ 2023-07-18 11:17 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-11-rananta@google.com>
On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> Currently, during the operations such as a hugepage collapse,
> KVM would flush the entire VM's context using 'vmalls12e1is'
> TLBI operation. Specifically, if the VM is faulting on many
> hugepages (say after dirty-logging), it creates a performance
> penalty for the guest whose pages have already been faulted
> earlier as they would have to refill their TLBs again.
>
> Instead, leverage kvm_tlb_flush_vmid_range() for table entries.
> If the system supports it, only the required range will be
> flushed. Else, it'll fallback to the previous mechanism.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/kvm/hyp/pgtable.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index 5d14d5d5819a..5ef098af1736 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -806,7 +806,8 @@ static bool stage2_try_break_pte(const struct kvm_pgtable_visit_ctx *ctx,
> * evicted pte value (if any).
> */
> if (kvm_pte_table(ctx->old, ctx->level))
> - kvm_call_hyp(__kvm_tlb_flush_vmid, mmu);
> + kvm_tlb_flush_vmid_range(mmu, ctx->addr,
> + kvm_granule_size(ctx->level));
> else if (kvm_pte_valid(ctx->old))
> kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu,
> ctx->addr, ctx->level);
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 09/11] KVM: arm64: Flush only the memslot after write-protect
From: Shaoqin Huang @ 2023-07-18 11:17 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-10-rananta@google.com>
On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> After write-protecting the region, currently KVM invalidates
> the entire TLB entries using kvm_flush_remote_tlbs(). Instead,
> scope the invalidation only to the targeted memslot. If
> supported, the architecture would use the range-based TLBI
> instructions to flush the memslot or else fallback to flushing
> all of the TLBs.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/kvm/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 387f2215fde7..985f605e2abc 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -1082,7 +1082,7 @@ static void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot)
> write_lock(&kvm->mmu_lock);
> stage2_wp_range(&kvm->arch.mmu, start, end);
> write_unlock(&kvm->mmu_lock);
> - kvm_flush_remote_tlbs(kvm);
> + kvm_flush_remote_tlbs_memslot(kvm, memslot);
> }
>
> /**
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 08/11] KVM: arm64: Implement kvm_arch_flush_remote_tlbs_range()
From: Shaoqin Huang @ 2023-07-18 11:15 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-9-rananta@google.com>
On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> Implement kvm_arch_flush_remote_tlbs_range() for arm64
> to invalidate the given range in the TLB.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/include/asm/kvm_host.h | 3 +++
> arch/arm64/kvm/mmu.c | 7 +++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 7281222f24ef..52d3ed918893 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -1114,6 +1114,9 @@ struct kvm *kvm_arch_alloc_vm(void);
> #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS
> int kvm_arch_flush_remote_tlbs(struct kvm *kvm);
>
> +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages);
> +
> static inline bool kvm_vm_is_protected(struct kvm *kvm)
> {
> return false;
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 0ac721fa27f1..387f2215fde7 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -172,6 +172,13 @@ int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
> return 0;
> }
>
> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages)
> +{
> + kvm_tlb_flush_vmid_range(&kvm->arch.mmu,
> + start_gfn << PAGE_SHIFT, pages << PAGE_SHIFT);
> + return 0;
> +}
> +
> static bool kvm_is_device_pfn(unsigned long pfn)
> {
> return !pfn_is_map_memory(pfn);
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 07/11] KVM: arm64: Define kvm_tlb_flush_vmid_range()
From: Shaoqin Huang @ 2023-07-18 8:39 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-8-rananta@google.com>
On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> Implement the helper kvm_tlb_flush_vmid_range() that acts
> as a wrapper for range-based TLB invalidations. For the
> given VMID, use the range-based TLBI instructions to do
> the job or fallback to invalidating all the TLB entries.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/include/asm/kvm_pgtable.h | 10 ++++++++++
> arch/arm64/kvm/hyp/pgtable.c | 20 ++++++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h
> index 8294a9a7e566..5e8b1ff07854 100644
> --- a/arch/arm64/include/asm/kvm_pgtable.h
> +++ b/arch/arm64/include/asm/kvm_pgtable.h
> @@ -754,4 +754,14 @@ enum kvm_pgtable_prot kvm_pgtable_stage2_pte_prot(kvm_pte_t pte);
> * kvm_pgtable_prot format.
> */
> enum kvm_pgtable_prot kvm_pgtable_hyp_pte_prot(kvm_pte_t pte);
> +
> +/**
> + * kvm_tlb_flush_vmid_range() - Invalidate/flush a range of TLB entries
> + *
> + * @mmu: Stage-2 KVM MMU struct
> + * @addr: The base Intermediate physical address from which to invalidate
> + * @size: Size of the range from the base to invalidate
> + */
> +void kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> + phys_addr_t addr, size_t size);
> #endif /* __ARM64_KVM_PGTABLE_H__ */
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index aa740a974e02..5d14d5d5819a 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -670,6 +670,26 @@ static bool stage2_has_fwb(struct kvm_pgtable *pgt)
> return !(pgt->flags & KVM_PGTABLE_S2_NOFWB);
> }
>
> +void kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> + phys_addr_t addr, size_t size)
> +{
> + unsigned long pages, inval_pages;
> +
> + if (!system_supports_tlb_range()) {
> + kvm_call_hyp(__kvm_tlb_flush_vmid, mmu);
> + return;
> + }
> +
> + pages = size >> PAGE_SHIFT;
> + while (pages > 0) {
> + inval_pages = min(pages, MAX_TLBI_RANGE_PAGES);
> + kvm_call_hyp(__kvm_tlb_flush_vmid_range, mmu, addr, inval_pages);
> +
> + addr += inval_pages << PAGE_SHIFT;
> + pages -= inval_pages;
> + }
> +}
> +
> #define KVM_S2_MEMATTR(pgt, attr) PAGE_S2_MEMATTR(attr, stage2_has_fwb(pgt))
>
> static int stage2_set_prot_attr(struct kvm_pgtable *pgt, enum kvm_pgtable_prot prot,
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 06/11] KVM: arm64: Implement __kvm_tlb_flush_vmid_range()
From: Shaoqin Huang @ 2023-07-18 7:50 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-7-rananta@google.com>
Hi Raghavendra,
On 7/15/23 08:54, Raghavendra Rao Ananta wrote:
> Define __kvm_tlb_flush_vmid_range() (for VHE and nVHE)
> to flush a range of stage-2 page-tables using IPA in one go.
> If the system supports FEAT_TLBIRANGE, the following patches
> would conviniently replace global TLBI such as vmalls12e1is
> in the map, unmap, and dirty-logging paths with ripas2e1is
> instead.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> ---
> arch/arm64/include/asm/kvm_asm.h | 3 +++
> arch/arm64/kvm/hyp/nvhe/hyp-main.c | 11 +++++++++++
> arch/arm64/kvm/hyp/nvhe/tlb.c | 30 ++++++++++++++++++++++++++++++
> arch/arm64/kvm/hyp/vhe/tlb.c | 23 +++++++++++++++++++++++
> 4 files changed, 67 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
> index 7d170aaa2db4..2c27cb8cf442 100644
> --- a/arch/arm64/include/asm/kvm_asm.h
> +++ b/arch/arm64/include/asm/kvm_asm.h
> @@ -70,6 +70,7 @@ enum __kvm_host_smccc_func {
> __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa,
> __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa_nsh,
> __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid,
> + __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_range,
> __KVM_HOST_SMCCC_FUNC___kvm_flush_cpu_context,
> __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntvoff,
> __KVM_HOST_SMCCC_FUNC___vgic_v3_read_vmcr,
> @@ -229,6 +230,8 @@ extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, phys_addr_t ipa,
> extern void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> phys_addr_t ipa,
> int level);
> +extern void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> + phys_addr_t start, unsigned long pages);
> extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu);
>
> extern void __kvm_timer_set_cntvoff(u64 cntvoff);
> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> index a169c619db60..857d9bc04fd4 100644
> --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> @@ -135,6 +135,16 @@ static void handle___kvm_tlb_flush_vmid_ipa_nsh(struct kvm_cpu_context *host_ctx
> __kvm_tlb_flush_vmid_ipa_nsh(kern_hyp_va(mmu), ipa, level);
> }
>
> +static void
> +handle___kvm_tlb_flush_vmid_range(struct kvm_cpu_context *host_ctxt)
> +{
> + DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
> + DECLARE_REG(phys_addr_t, start, host_ctxt, 2);
> + DECLARE_REG(unsigned long, pages, host_ctxt, 3);
> +
> + __kvm_tlb_flush_vmid_range(kern_hyp_va(mmu), start, pages);
> +}
> +
> static void handle___kvm_tlb_flush_vmid(struct kvm_cpu_context *host_ctxt)
> {
> DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
> @@ -327,6 +337,7 @@ static const hcall_t host_hcall[] = {
> HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa),
> HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa_nsh),
> HANDLE_FUNC(__kvm_tlb_flush_vmid),
> + HANDLE_FUNC(__kvm_tlb_flush_vmid_range),
> HANDLE_FUNC(__kvm_flush_cpu_context),
> HANDLE_FUNC(__kvm_timer_set_cntvoff),
> HANDLE_FUNC(__vgic_v3_read_vmcr),
> diff --git a/arch/arm64/kvm/hyp/nvhe/tlb.c b/arch/arm64/kvm/hyp/nvhe/tlb.c
> index b9991bbd8e3f..09347111c2cd 100644
> --- a/arch/arm64/kvm/hyp/nvhe/tlb.c
> +++ b/arch/arm64/kvm/hyp/nvhe/tlb.c
> @@ -182,6 +182,36 @@ void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> __tlb_switch_to_host(&cxt);
> }
>
> +void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> + phys_addr_t start, unsigned long pages)
> +{
> + struct tlb_inv_context cxt;
> + unsigned long stride;
> +
> + /*
> + * Since the range of addresses may not be mapped at
> + * the same level, assume the worst case as PAGE_SIZE
> + */
> + stride = PAGE_SIZE;
> + start = round_down(start, stride);
> +
> + /* Switch to requested VMID */
> + __tlb_switch_to_guest(mmu, &cxt, false);
> +
> + __flush_tlb_range_op(ipas2e1is, start, pages, stride, 0, 0, false);
> +
> + dsb(ish);
> + __tlbi(vmalle1is);
> + dsb(ish);
> + isb();
> +
> + /* See the comment in __kvm_tlb_flush_vmid_ipa() */
> + if (icache_is_vpipt())
> + icache_inval_all_pou();
> +
> + __tlb_switch_to_host(&cxt);
> +}
> +
> void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu)
> {
> struct tlb_inv_context cxt;
> diff --git a/arch/arm64/kvm/hyp/vhe/tlb.c b/arch/arm64/kvm/hyp/vhe/tlb.c
> index e69da550cdc5..4ed8a1786812 100644
> --- a/arch/arm64/kvm/hyp/vhe/tlb.c
> +++ b/arch/arm64/kvm/hyp/vhe/tlb.c
> @@ -138,6 +138,29 @@ void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu,
> dsb(nsh);
> __tlbi(vmalle1);
> dsb(nsh);
> +
> + __tlb_switch_to_host(&cxt);
> +}
> +
> +void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
> + phys_addr_t start, unsigned long pages)
> +{
> + struct tlb_inv_context cxt;
> + unsigned long stride;
> +
> + /*
> + * Since the range of addresses may not be mapped at
> + * the same level, assume the worst case as PAGE_SIZE
> + */
> + stride = PAGE_SIZE;
> + start = round_down(start, stride);
> +
Is there lack of switch VMID to guest?
__tlb_switch_to_guest(mmu, &cxt, false);
Thanks,
Shaoqin
> + dsb(ishst);
> + __flush_tlb_range_op(ipas2e1is, start, pages, stride, 0, 0, false);
> +
> + dsb(ish);
> + __tlbi(vmalle1is);
> + dsb(ish);
> isb();
>
> __tlb_switch_to_host(&cxt);
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v4 2/2] irqchip/loongson-eiointc: Simplify irq routing on some platforms
From: bibo mao @ 2023-07-18 7:01 UTC (permalink / raw)
To: Jianmin Lv
Cc: linux-mips, linux-kernel, Philippe Mathieu-Daudé,
Huacai Chen, Jiaxun Yang, Marc Zyngier
In-Reply-To: <20230713032243.2046205-3-maobibo@loongson.cn>
Jianmin,
Do you have any comments so that I can update in the next version together?
since you are original author of eiointc driver.
Is it possible to add extra specific version in eiointc acpi table for
virt-machine in future? For specific eiointc, irq can be routed to all
cpus rather cpu 0-3, I do not know whether it is deserved for qemu
virt-machine alone.
Regards
Bibo Mao
在 2023/7/13 11:22, Bibo Mao 写道:
> Some LoongArch systems have only one eiointc node such as 3A5000/2K2000
> and qemu virt-machine. If there is only one eiointc node, all cpus can
> access eiointc registers directly; if there is multiple eiointc nodes, each
> cpu can only access eiointc belonging to specified node group, so anysend
> or ipi needs to be used to configure irq routing. IRQ routing is simple on
> such systems with one node, hacking method like anysend is not necessary.
>
> This patch provides simpile IRQ routing method for systems with one eiointc
> node, and is tested on 3A5000 board and qemu virt-machine.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> drivers/irqchip/irq-loongson-eiointc.c | 80 ++++++++++++++++++++++++--
> 1 file changed, 74 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
> index 603d323b8f8b..e6be9d6a18c8 100644
> --- a/drivers/irqchip/irq-loongson-eiointc.c
> +++ b/drivers/irqchip/irq-loongson-eiointc.c
> @@ -127,6 +127,48 @@ static int eiointc_set_irq_affinity(struct irq_data *d, const struct cpumask *af
> return IRQ_SET_MASK_OK;
> }
>
> +static int eiointc_single_set_irq_affinity(struct irq_data *d,
> + const struct cpumask *affinity, bool force)
> +{
> + unsigned int cpu;
> + unsigned long flags;
> + uint32_t vector, regaddr, data, coremap;
> + struct cpumask mask;
> + struct eiointc_priv *priv = d->domain->host_data;
> +
> + cpumask_and(&mask, affinity, cpu_online_mask);
> + cpumask_and(&mask, &mask, &priv->cpuspan_map);
> + if (cpumask_empty(&mask))
> + return -EINVAL;
> +
> + cpu = cpumask_first(&mask);
> + vector = d->hwirq;
> + regaddr = EIOINTC_REG_ENABLE + ((vector >> 5) << 2);
> + data = ~BIT(vector & 0x1F);
> + coremap = BIT(cpu_logical_map(cpu) % CORES_PER_EIO_NODE);
> +
> + /*
> + * simplify for platform with only one eiointc node
> + * access eiointc registers directly rather than
> + * use any_send method here
> + */
> + raw_spin_lock_irqsave(&affinity_lock, flags);
> + iocsr_write32(EIOINTC_ALL_ENABLE & data, regaddr);
> + /*
> + * get irq route info for continuous 4 vectors
> + * and set affinity for specified vector
> + */
> + data = iocsr_read32(EIOINTC_REG_ROUTE + (vector & ~3));
> + data &= ~(0xff << ((vector & 3) * 8));
> + data |= coremap << ((vector & 3) * 8);
> + iocsr_write32(data, EIOINTC_REG_ROUTE + (vector & ~3));
> + iocsr_write32(EIOINTC_ALL_ENABLE, regaddr);
> + raw_spin_unlock_irqrestore(&affinity_lock, flags);
> +
> + irq_data_update_effective_affinity(d, cpumask_of(cpu));
> + return IRQ_SET_MASK_OK;
> +}
> +
> static int eiointc_index(int node)
> {
> int i;
> @@ -238,22 +280,39 @@ static struct irq_chip eiointc_irq_chip = {
> .irq_set_affinity = eiointc_set_irq_affinity,
> };
>
> +static struct irq_chip eiointc_irq_chipi_single = {
> + .name = "EIOINTC-S",
> + .irq_ack = eiointc_ack_irq,
> + .irq_mask = eiointc_mask_irq,
> + .irq_unmask = eiointc_unmask_irq,
> +#ifdef CONFIG_SMP
> + .irq_set_affinity = eiointc_single_set_irq_affinity,
> +#endif
> +};
> +
> static int eiointc_domain_alloc(struct irq_domain *domain, unsigned int virq,
> unsigned int nr_irqs, void *arg)
> {
> int ret;
> unsigned int i, type;
> unsigned long hwirq = 0;
> - struct eiointc *priv = domain->host_data;
> + struct eiointc_priv *priv = domain->host_data;
> + struct irq_chip *chip;
>
> ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type);
> if (ret)
> return ret;
>
> - for (i = 0; i < nr_irqs; i++) {
> - irq_domain_set_info(domain, virq + i, hwirq + i, &eiointc_irq_chip,
> + /*
> + * use simple irq routing method on single eiointc node
> + */
> + if ((nr_pics == 1) && (nodes_weight(priv->node_map) == 1))
> + chip = &eiointc_irq_chipi_single;
> + else
> + chip = &eiointc_irq_chip;
> + for (i = 0; i < nr_irqs; i++)
> + irq_domain_set_info(domain, virq + i, hwirq + i, chip,
> priv, handle_edge_irq, NULL, NULL);
> - }
>
> return 0;
> }
> @@ -310,6 +369,7 @@ static void eiointc_resume(void)
> int i, j;
> struct irq_desc *desc;
> struct irq_data *irq_data;
> + struct irq_chip *chip;
>
> eiointc_router_init(0);
>
> @@ -319,7 +379,8 @@ static void eiointc_resume(void)
> if (desc && desc->handle_irq && desc->handle_irq != handle_bad_irq) {
> raw_spin_lock(&desc->lock);
> irq_data = irq_domain_get_irq_data(eiointc_priv[i]->eiointc_domain, irq_desc_get_irq(desc));
> - eiointc_set_irq_affinity(irq_data, irq_data->common->affinity, 0);
> + chip = irq_data_get_irq_chip(irq_data);
> + chip->irq_set_affinity(irq_data, irq_data->common->affinity, 0);
> raw_spin_unlock(&desc->lock);
> }
> }
> @@ -497,7 +558,14 @@ static int __init eiointc_of_init(struct device_node *of_node,
> priv->node = 0;
> priv->domain_handle = of_node_to_fwnode(of_node);
>
> - ret = eiointc_init(priv, parent_irq, 0);
> + /*
> + * 2k0500 and 2k2000 has only one eiointc node
> + * set nodemap as 1 for simple irq routing
> + *
> + * Fixme: what about future embedded boards with more than 4 cpus?
> + * nodemap and node need be added in dts like acpi table
> + */
> + ret = eiointc_init(priv, parent_irq, 1);
> if (ret < 0)
> goto out_free_priv;
>
^ permalink raw reply
* Re: [PATCH] usb: Explicitly include correct DT includes
From: Herve Codina @ 2023-07-18 6:31 UTC (permalink / raw)
To: Rob Herring
Cc: Peter Chen, Pawel Laszczak, Roger Quadros, Aswath Govindraju,
Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Thierry Reding, Jonathan Hunter, Minas Harutyunyan, Thinh Nguyen,
Li Yang, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Michal Simek, Alan Stern, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Mathias Nyman, Richard Leitner, Chunfeng Yun,
Paul Cercueil, Bin Liu, Conor Dooley, Daire McNamara,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Guenter Roeck,
Heikki Krogerus, Bryan O'Donoghue, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Matthias Brugger,
AngeloGioacchino Del Regno, devicetree, linux-usb, linux-kernel,
linux-arm-kernel, linux-tegra, linuxppc-dev, linux-renesas-soc,
linux-mediatek, linux-mips, linux-riscv, linux-sunxi,
linux-arm-msm
In-Reply-To: <20230714175027.4065135-1-robh@kernel.org>
Hi Rob,
On Fri, 14 Jul 2023 11:50:23 -0600
Rob Herring <robh@kernel.org> wrote:
> The DT of_device.h and of_platform.h date back to the separate
> of_platform_bus_type before it as merged into the regular platform bus.
> As part of that merge prepping Arm DT support 13 years ago, they
> "temporarily" include each other. They also include platform_device.h
> and of.h. As a result, there's a pretty much random mix of those include
> files used throughout the tree. In order to detangle these headers and
> replace the implicit includes with struct declarations, users need to
> explicitly include the correct includes.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
[...]
> diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c
> index 6cd0af83e91e..3482b41d0646 100644
> --- a/drivers/usb/gadget/udc/renesas_usbf.c
> +++ b/drivers/usb/gadget/udc/renesas_usbf.c
> @@ -12,10 +12,9 @@
> #include <linux/iopoll.h>
> #include <linux/kernel.h>
> #include <linux/kfifo.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/module.h>
> -#include <linux/of_address.h>
> -#include <linux/of_irq.h>
> -#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/types.h>
> #include <linux/usb/composite.h>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
^ permalink raw reply
* Re: [PATCH v6 05/11] arm64: tlb: Refactor the core flush algorithm of __flush_tlb_range
From: Shaoqin Huang @ 2023-07-18 6:21 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Catalin Marinas, Gavin Shan
In-Reply-To: <20230715005405.3689586-6-rananta@google.com>
On 7/15/23 08:53, Raghavendra Rao Ananta wrote:
> Currently, the core TLB flush functionality of __flush_tlb_range()
> hardcodes vae1is (and variants) for the flush operation. In the
> upcoming patches, the KVM code reuses this core algorithm with
> ipas2e1is for range based TLB invalidations based on the IPA.
> Hence, extract the core flush functionality of __flush_tlb_range()
> into its own macro that accepts an 'op' argument to pass any
> TLBI operation, such that other callers (KVM) can benefit.
>
> No functional changes intended.
>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/include/asm/tlbflush.h | 109 +++++++++++++++---------------
> 1 file changed, 56 insertions(+), 53 deletions(-)
>
> diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h
> index 412a3b9a3c25..f7fafba25add 100644
> --- a/arch/arm64/include/asm/tlbflush.h
> +++ b/arch/arm64/include/asm/tlbflush.h
> @@ -278,14 +278,62 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
> */
> #define MAX_TLBI_OPS PTRS_PER_PTE
>
> +/* When the CPU does not support TLB range operations, flush the TLB
> + * entries one by one at the granularity of 'stride'. If the TLB
> + * range ops are supported, then:
> + *
> + * 1. If 'pages' is odd, flush the first page through non-range
> + * operations;
> + *
> + * 2. For remaining pages: the minimum range granularity is decided
> + * by 'scale', so multiple range TLBI operations may be required.
> + * Start from scale = 0, flush the corresponding number of pages
> + * ((num+1)*2^(5*scale+1) starting from 'addr'), then increase it
> + * until no pages left.
> + *
> + * Note that certain ranges can be represented by either num = 31 and
> + * scale or num = 0 and scale + 1. The loop below favours the latter
> + * since num is limited to 30 by the __TLBI_RANGE_NUM() macro.
> + */
> +#define __flush_tlb_range_op(op, start, pages, stride, \
> + asid, tlb_level, tlbi_user) \
> +do { \
> + int num = 0; \
> + int scale = 0; \
> + unsigned long addr; \
> + \
> + while (pages > 0) { \
> + if (!system_supports_tlb_range() || \
> + pages % 2 == 1) { \
> + addr = __TLBI_VADDR(start, asid); \
> + __tlbi_level(op, addr, tlb_level); \
> + if (tlbi_user) \
> + __tlbi_user_level(op, addr, tlb_level); \
> + start += stride; \
> + pages -= stride >> PAGE_SHIFT; \
> + continue; \
> + } \
> + \
> + num = __TLBI_RANGE_NUM(pages, scale); \
> + if (num >= 0) { \
> + addr = __TLBI_VADDR_RANGE(start, asid, scale, \
> + num, tlb_level); \
> + __tlbi(r##op, addr); \
> + if (tlbi_user) \
> + __tlbi_user(r##op, addr); \
> + start += __TLBI_RANGE_PAGES(num, scale) << PAGE_SHIFT; \
> + pages -= __TLBI_RANGE_PAGES(num, scale); \
> + } \
> + scale++; \
> + } \
> +} while (0)
> +
> static inline void __flush_tlb_range(struct vm_area_struct *vma,
> unsigned long start, unsigned long end,
> unsigned long stride, bool last_level,
> int tlb_level)
> {
> - int num = 0;
> - int scale = 0;
> - unsigned long asid, addr, pages;
> + unsigned long asid, pages;
>
> start = round_down(start, stride);
> end = round_up(end, stride);
> @@ -307,56 +355,11 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma,
> dsb(ishst);
> asid = ASID(vma->vm_mm);
>
> - /*
> - * When the CPU does not support TLB range operations, flush the TLB
> - * entries one by one at the granularity of 'stride'. If the TLB
> - * range ops are supported, then:
> - *
> - * 1. If 'pages' is odd, flush the first page through non-range
> - * operations;
> - *
> - * 2. For remaining pages: the minimum range granularity is decided
> - * by 'scale', so multiple range TLBI operations may be required.
> - * Start from scale = 0, flush the corresponding number of pages
> - * ((num+1)*2^(5*scale+1) starting from 'addr'), then increase it
> - * until no pages left.
> - *
> - * Note that certain ranges can be represented by either num = 31 and
> - * scale or num = 0 and scale + 1. The loop below favours the latter
> - * since num is limited to 30 by the __TLBI_RANGE_NUM() macro.
> - */
> - while (pages > 0) {
> - if (!system_supports_tlb_range() ||
> - pages % 2 == 1) {
> - addr = __TLBI_VADDR(start, asid);
> - if (last_level) {
> - __tlbi_level(vale1is, addr, tlb_level);
> - __tlbi_user_level(vale1is, addr, tlb_level);
> - } else {
> - __tlbi_level(vae1is, addr, tlb_level);
> - __tlbi_user_level(vae1is, addr, tlb_level);
> - }
> - start += stride;
> - pages -= stride >> PAGE_SHIFT;
> - continue;
> - }
> -
> - num = __TLBI_RANGE_NUM(pages, scale);
> - if (num >= 0) {
> - addr = __TLBI_VADDR_RANGE(start, asid, scale,
> - num, tlb_level);
> - if (last_level) {
> - __tlbi(rvale1is, addr);
> - __tlbi_user(rvale1is, addr);
> - } else {
> - __tlbi(rvae1is, addr);
> - __tlbi_user(rvae1is, addr);
> - }
> - start += __TLBI_RANGE_PAGES(num, scale) << PAGE_SHIFT;
> - pages -= __TLBI_RANGE_PAGES(num, scale);
> - }
> - scale++;
> - }
> + if (last_level)
> + __flush_tlb_range_op(vale1is, start, pages, stride, asid, tlb_level, true);
> + else
> + __flush_tlb_range_op(vae1is, start, pages, stride, asid, tlb_level, true);
> +
> dsb(ish);
> }
>
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 03/11] KVM: Allow range-based TLB invalidation from common code
From: Shaoqin Huang @ 2023-07-18 2:49 UTC (permalink / raw)
To: Raghavendra Rao Ananta
Cc: Oliver Upton, Marc Zyngier, James Morse, Suzuki K Poulose,
Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <CAJHc60zhVco3uTq97vDHMk8cgg1psPtwHT6MN1eKP1Yr18d9cw@mail.gmail.com>
On 7/18/23 00:37, Raghavendra Rao Ananta wrote:
> On Mon, Jul 17, 2023 at 4:40 AM Shaoqin Huang <shahuang@redhat.com> wrote:
>>
>>
>>
>> On 7/15/23 08:53, Raghavendra Rao Ananta wrote:
>>> From: David Matlack <dmatlack@google.com>
>>>
>>> Make kvm_flush_remote_tlbs_range() visible in common code and create a
>>> default implementation that just invalidates the whole TLB.
>>>
>>> This paves the way for several future features/cleanups:
>>>
>>> - Introduction of range-based TLBI on ARM.
>>> - Eliminating kvm_arch_flush_remote_tlbs_memslot()
>>> - Moving the KVM/x86 TDP MMU to common code.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: David Matlack <dmatlack@google.com>
>>> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
>>> Reviewed-by: Gavin Shan <gshan@redhat.com>
>>> ---
>>> arch/x86/include/asm/kvm_host.h | 3 +++
>>> arch/x86/kvm/mmu/mmu.c | 9 ++++-----
>>> arch/x86/kvm/mmu/mmu_internal.h | 3 ---
>>> include/linux/kvm_host.h | 9 +++++++++
>>> virt/kvm/kvm_main.c | 13 +++++++++++++
>>> 5 files changed, 29 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>>> index a2d3cfc2eb75..08900afbf2ad 100644
>>> --- a/arch/x86/include/asm/kvm_host.h
>>> +++ b/arch/x86/include/asm/kvm_host.h
>>> @@ -1804,6 +1804,9 @@ static inline int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
>>> return -ENOTSUPP;
>>> }
>>>
>>> +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
>>> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages);
>>> +
>>> #define kvm_arch_pmi_in_guest(vcpu) \
>>> ((vcpu) && (vcpu)->arch.handling_intr_from_guest)
>>>
>>> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
>>> index ec169f5c7dce..aaa5e336703a 100644
>>> --- a/arch/x86/kvm/mmu/mmu.c
>>> +++ b/arch/x86/kvm/mmu/mmu.c
>>> @@ -278,16 +278,15 @@ static inline bool kvm_available_flush_remote_tlbs_range(void)
>>> return kvm_x86_ops.flush_remote_tlbs_range;
>>> }
>>>
>>> -void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn,
>>> - gfn_t nr_pages)
>>> +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages)
>>> {
>>> int ret = -EOPNOTSUPP;
>>>
>>> if (kvm_x86_ops.flush_remote_tlbs_range)
>>> ret = static_call(kvm_x86_flush_remote_tlbs_range)(kvm, start_gfn,
>>> - nr_pages);
>>> - if (ret)
>>> - kvm_flush_remote_tlbs(kvm);
>>> + pages);
>> This will be good if parameter pages aligned with parameter kvm.
>>
> Agreed, but pulling 'pages' above brings the char count to 83. If
> that's acceptable, I'm happy to do it in v7.
> Hi Raghavendra,
no need to pulling 'pages' above, just delete one tab, and add some
space before the pages, just like the original `nr_pages` position.
Thanks,
Shaoqin
> Thank you.
> Raghavendra
>> Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
>>> +
>>> + return ret;
>>> }
>>>
>>> static gfn_t kvm_mmu_page_get_gfn(struct kvm_mmu_page *sp, int index);
>>> diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
>>> index d39af5639ce9..86cb83bb3480 100644
>>> --- a/arch/x86/kvm/mmu/mmu_internal.h
>>> +++ b/arch/x86/kvm/mmu/mmu_internal.h
>>> @@ -170,9 +170,6 @@ bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm,
>>> struct kvm_memory_slot *slot, u64 gfn,
>>> int min_level);
>>>
>>> -void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn,
>>> - gfn_t nr_pages);
>>> -
>>> /* Flush the given page (huge or not) of guest memory. */
>>> static inline void kvm_flush_remote_tlbs_gfn(struct kvm *kvm, gfn_t gfn, int level)
>>> {
>>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>>> index e3f968b38ae9..a731967b24ff 100644
>>> --- a/include/linux/kvm_host.h
>>> +++ b/include/linux/kvm_host.h
>>> @@ -1359,6 +1359,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target);
>>> void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool yield_to_kernel_mode);
>>>
>>> void kvm_flush_remote_tlbs(struct kvm *kvm);
>>> +void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages);
>>>
>>> #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
>>> int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min);
>>> @@ -1486,6 +1487,14 @@ static inline int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
>>> }
>>> #endif
>>>
>>> +#ifndef __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
>>> +static inline int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm,
>>> + gfn_t gfn, u64 pages)
>>> +{
>>> + return -EOPNOTSUPP;
>>> +}
>>> +#endif
>>> +
>>> #ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA
>>> void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
>>> void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
>>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>>> index d6b050786155..804470fccac7 100644
>>> --- a/virt/kvm/kvm_main.c
>>> +++ b/virt/kvm/kvm_main.c
>>> @@ -366,6 +366,19 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
>>> }
>>> EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs);
>>>
>>> +void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages)
>>> +{
>>> + if (!kvm_arch_flush_remote_tlbs_range(kvm, gfn, pages))
>>> + return;
>>> +
>>> + /*
>>> + * Fall back to a flushing entire TLBs if the architecture range-based
>>> + * TLB invalidation is unsupported or can't be performed for whatever
>>> + * reason.
>>> + */
>>> + kvm_flush_remote_tlbs(kvm);
>>> +}
>>> +
>>> static void kvm_flush_shadow_all(struct kvm *kvm)
>>> {
>>> kvm_arch_flush_shadow_all(kvm);
>>
>> --
>> Shaoqin
>>
>
--
Shaoqin
^ permalink raw reply
* Re: [PATCH v6 04/11] KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common code
From: Shaoqin Huang @ 2023-07-18 2:47 UTC (permalink / raw)
To: Raghavendra Rao Ananta, Oliver Upton, Marc Zyngier, James Morse,
Suzuki K Poulose
Cc: Paolo Bonzini, Sean Christopherson, Huacai Chen, Zenghui Yu,
Anup Patel, Atish Patra, Jing Zhang, Colton Lewis, David Matlack,
linux-arm-kernel, kvmarm, linux-mips, kvm-riscv, linux-riscv,
linux-kernel, kvm, Gavin Shan
In-Reply-To: <20230715005405.3689586-5-rananta@google.com>
On 7/15/23 08:53, Raghavendra Rao Ananta wrote:
> From: David Matlack <dmatlack@google.com>
>
> Move kvm_arch_flush_remote_tlbs_memslot() to common code and drop
> "arch_" from the name. kvm_arch_flush_remote_tlbs_memslot() is just a
> range-based TLB invalidation where the range is defined by the memslot.
> Now that kvm_flush_remote_tlbs_range() can be called from common code we
> can just use that and drop a bunch of duplicate code from the arch
> directories.
>
> Note this adds a lockdep assertion for slots_lock being held when
> calling kvm_flush_remote_tlbs_memslot(), which was previously only
> asserted on x86. MIPS has calls to kvm_flush_remote_tlbs_memslot(),
> but they all hold the slots_lock, so the lockdep assertion continues to
> hold true.
>
> Also drop the CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT ifdef gating
> kvm_flush_remote_tlbs_memslot(), since it is no longer necessary.
>
> Signed-off-by: David Matlack <dmatlack@google.com>
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> arch/arm64/kvm/arm.c | 6 ------
> arch/mips/kvm/mips.c | 10 ++--------
> arch/riscv/kvm/mmu.c | 6 ------
> arch/x86/kvm/mmu/mmu.c | 16 +---------------
> arch/x86/kvm/x86.c | 2 +-
> include/linux/kvm_host.h | 7 +++----
> virt/kvm/kvm_main.c | 18 ++++++++++++++++--
> 7 files changed, 23 insertions(+), 42 deletions(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index c2c14059f6a8..ed7bef4d970b 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -1525,12 +1525,6 @@ void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
>
> }
>
> -void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
> - const struct kvm_memory_slot *memslot)
> -{
> - kvm_flush_remote_tlbs(kvm);
> -}
> -
> static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm,
> struct kvm_arm_device_addr *dev_addr)
> {
> diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
> index 4b7bc39a4173..231ac052b506 100644
> --- a/arch/mips/kvm/mips.c
> +++ b/arch/mips/kvm/mips.c
> @@ -199,7 +199,7 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
> /* Flush slot from GPA */
> kvm_mips_flush_gpa_pt(kvm, slot->base_gfn,
> slot->base_gfn + slot->npages - 1);
> - kvm_arch_flush_remote_tlbs_memslot(kvm, slot);
> + kvm_flush_remote_tlbs_memslot(kvm, slot);
> spin_unlock(&kvm->mmu_lock);
> }
>
> @@ -235,7 +235,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
> needs_flush = kvm_mips_mkclean_gpa_pt(kvm, new->base_gfn,
> new->base_gfn + new->npages - 1);
> if (needs_flush)
> - kvm_arch_flush_remote_tlbs_memslot(kvm, new);
> + kvm_flush_remote_tlbs_memslot(kvm, new);
> spin_unlock(&kvm->mmu_lock);
> }
> }
> @@ -987,12 +987,6 @@ int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
> return 1;
> }
>
> -void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
> - const struct kvm_memory_slot *memslot)
> -{
> - kvm_flush_remote_tlbs(kvm);
> -}
> -
> int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
> {
> int r;
> diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c
> index f2eb47925806..97e129620686 100644
> --- a/arch/riscv/kvm/mmu.c
> +++ b/arch/riscv/kvm/mmu.c
> @@ -406,12 +406,6 @@ void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
> {
> }
>
> -void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
> - const struct kvm_memory_slot *memslot)
> -{
> - kvm_flush_remote_tlbs(kvm);
> -}
> -
> void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free)
> {
> }
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index aaa5e336703a..b320a4254a2b 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -6669,7 +6669,7 @@ static void kvm_rmap_zap_collapsible_sptes(struct kvm *kvm,
> */
> if (walk_slot_rmaps(kvm, slot, kvm_mmu_zap_collapsible_spte,
> PG_LEVEL_4K, KVM_MAX_HUGEPAGE_LEVEL - 1, true))
> - kvm_arch_flush_remote_tlbs_memslot(kvm, slot);
> + kvm_flush_remote_tlbs_memslot(kvm, slot);
> }
>
> void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
> @@ -6688,20 +6688,6 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
> }
> }
>
> -void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
> - const struct kvm_memory_slot *memslot)
> -{
> - /*
> - * All current use cases for flushing the TLBs for a specific memslot
> - * related to dirty logging, and many do the TLB flush out of mmu_lock.
> - * The interaction between the various operations on memslot must be
> - * serialized by slots_locks to ensure the TLB flush from one operation
> - * is observed by any other operation on the same memslot.
> - */
> - lockdep_assert_held(&kvm->slots_lock);
> - kvm_flush_remote_tlbs_range(kvm, memslot->base_gfn, memslot->npages);
> -}
> -
> void kvm_mmu_slot_leaf_clear_dirty(struct kvm *kvm,
> const struct kvm_memory_slot *memslot)
> {
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index a6b9bea62fb8..faeb2e307b36 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -12751,7 +12751,7 @@ static void kvm_mmu_slot_apply_flags(struct kvm *kvm,
> * See is_writable_pte() for more details (the case involving
> * access-tracked SPTEs is particularly relevant).
> */
> - kvm_arch_flush_remote_tlbs_memslot(kvm, new);
> + kvm_flush_remote_tlbs_memslot(kvm, new);
> }
> }
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index a731967b24ff..45899ce9ed31 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -1360,6 +1360,8 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu, bool yield_to_kernel_mode);
>
> void kvm_flush_remote_tlbs(struct kvm *kvm);
> void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages);
> +void kvm_flush_remote_tlbs_memslot(struct kvm *kvm,
> + const struct kvm_memory_slot *memslot);
>
> #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
> int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min);
> @@ -1388,10 +1390,7 @@ void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
> unsigned long mask);
> void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot);
>
> -#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
> -void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
> - const struct kvm_memory_slot *memslot);
> -#else /* !CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT */
> +#ifndef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
> int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log);
> int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log,
> int *is_dirty, struct kvm_memory_slot **memslot);
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 804470fccac7..58213cc4b9b9 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -379,6 +379,20 @@ void kvm_flush_remote_tlbs_range(struct kvm *kvm, gfn_t gfn, u64 pages)
> kvm_flush_remote_tlbs(kvm);
> }
>
> +void kvm_flush_remote_tlbs_memslot(struct kvm *kvm,
> + const struct kvm_memory_slot *memslot)
> +{
> + /*
> + * All current use cases for flushing the TLBs for a specific memslot
> + * related to dirty logging, and many do the TLB flush out of mmu_lock.
> + * The interaction between the various operations on memslot must be
> + * serialized by slots_locks to ensure the TLB flush from one operation
> + * is observed by any other operation on the same memslot.
> + */
> + lockdep_assert_held(&kvm->slots_lock);
> + kvm_flush_remote_tlbs_range(kvm, memslot->base_gfn, memslot->npages);
> +}
> +
> static void kvm_flush_shadow_all(struct kvm *kvm)
> {
> kvm_arch_flush_shadow_all(kvm);
> @@ -2191,7 +2205,7 @@ static int kvm_get_dirty_log_protect(struct kvm *kvm, struct kvm_dirty_log *log)
> }
>
> if (flush)
> - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot);
> + kvm_flush_remote_tlbs_memslot(kvm, memslot);
>
> if (copy_to_user(log->dirty_bitmap, dirty_bitmap_buffer, n))
> return -EFAULT;
> @@ -2308,7 +2322,7 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
> KVM_MMU_UNLOCK(kvm);
>
> if (flush)
> - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot);
> + kvm_flush_remote_tlbs_memslot(kvm, memslot);
>
> return 0;
> }
--
Shaoqin
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox