From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A57CC64EC5 for ; Mon, 6 Feb 2023 17:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjBFRyb (ORCPT ); Mon, 6 Feb 2023 12:54:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbjBFRy3 (ORCPT ); Mon, 6 Feb 2023 12:54:29 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF1EC22A17; Mon, 6 Feb 2023 09:54:28 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 5A6ED20C7E05; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5A6ED20C7E05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=XBhdKOHkvPs8POoch+S8/oQy8eii1UwO03wWmawGfqo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BUMMuuZ8uFilGy7XpaHKkXF9Ew+8I5lybguqVWwbH04//091X9ealEPwnKEDXMwad AE13QUO8m2e+DpLChzEgkXzLaLyKwjmt5GOedlrYNweNr9dQSkq3pQsyehcnyCtV4X WWmIn0cyAdLrgGYmQyVgtFDBNyCzxLLrxL1ivusw= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 1/6] drivers/clocksource/hyper-v: non ACPI support in hyperv clock Date: Mon, 6 Feb 2023 09:54:15 -0800 Message-Id: <1675706060-22361-2-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a placeholder function for the hv_setup_stimer0_irq API to accommodate systems without ACPI support. Since this function is not utilized on x86/x64 systems and non-ACPI support is only intended for x86/x64 systems, a placeholder function is sufficient for now and can be improved upon if necessary in the future. This change will make it easier to add device tree support for VMBus in subsequent commits. Signed-off-by: Saurabh Sengar --- drivers/clocksource/hyperv_timer.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyper= v_timer.c index c0cef92b12b8..f32948c8a96f 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -49,7 +49,7 @@ static bool direct_mode_enabled; =20 static int stimer0_irq =3D -1; static int stimer0_message_sint; -static DEFINE_PER_CPU(long, stimer0_evt); +static __maybe_unused DEFINE_PER_CPU(long, stimer0_evt); =20 /* * Common code for stimer0 interrupts coming via Direct Mode or @@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(hv_stimer0_isr); * stimer0 interrupt handler for architectures that support * per-cpu interrupts, which also implies Direct Mode. */ -static irqreturn_t hv_stimer0_percpu_isr(int irq, void *dev_id) +static irqreturn_t __maybe_unused hv_stimer0_percpu_isr(int irq, void *dev= _id) { hv_stimer0_isr(); return IRQ_HANDLED; @@ -196,6 +196,7 @@ void __weak hv_remove_stimer0_handler(void) { }; =20 +#ifdef CONFIG_ACPI /* Called only on architectures with per-cpu IRQs (i.e., not x86/x64) */ static int hv_setup_stimer0_irq(void) { @@ -230,6 +231,16 @@ static void hv_remove_stimer0_irq(void) stimer0_irq =3D -1; } } +#else +static int hv_setup_stimer0_irq(void) +{ + return 0; +} + +static void hv_remove_stimer0_irq(void) +{ +} +#endif =20 /* hv_stimer_alloc - Global initialization of the clockevent and stimer0 */ int hv_stimer_alloc(bool have_percpu_irqs) --=20 2.25.1 From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D259C636D3 for ; Mon, 6 Feb 2023 17:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjBFRyf (ORCPT ); Mon, 6 Feb 2023 12:54:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjBFRy3 (ORCPT ); Mon, 6 Feb 2023 12:54:29 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0701023131; Mon, 6 Feb 2023 09:54:28 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 72FA120C7E06; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 72FA120C7E06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=6TOzOHNuOYRZLgJ5e6g2o3t3C9KRoSgljHBsyQDtJMk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lodkqHyuni3tPNzCPMJpHVI1J0cnsu1xkx/H/vTzwv+HumRYwh1Rdwh3ibVImprup BhNg3A7QEr91JSQzQvEHOJpnOIy9FCuvyz3rzfwWPCVjYZymfOEq1YkmYjybTJ4s5R UCH9v6OQUvVCQPE2WEpZX6himCENNXWojjagOP/4= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 2/6] Drivers: hv: allow non ACPI compilation for hv_is_hibernation_supported Date: Mon, 6 Feb 2023 09:54:16 -0800 Message-Id: <1675706060-22361-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" acpi_sleep_state_supported API is only define for CONFIG_ACPI flag and thus it can't be used for non-ACPI builds. Initially there won't be hibernation support for non ACPI builds. This change will help adding device tree support in subsequent commits. Signed-off-by: Saurabh Sengar --- [V3] - Typos fix: s/Initaly/Initially/ and s/hibernate/hibernation/. drivers/hv/hv_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 52a6f89ccdbd..370ec20d1993 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -234,7 +234,11 @@ EXPORT_SYMBOL_GPL(hv_setup_dma_ops); =20 bool hv_is_hibernation_supported(void) { +#ifdef CONFIG_ACPI return !hv_root_partition && acpi_sleep_state_supported(ACPI_STATE_S4); +#else + return false; +#endif } EXPORT_SYMBOL_GPL(hv_is_hibernation_supported); =20 --=20 2.25.1 From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A2D9C636D4 for ; Mon, 6 Feb 2023 17:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjBFRyi (ORCPT ); Mon, 6 Feb 2023 12:54:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbjBFRya (ORCPT ); Mon, 6 Feb 2023 12:54:30 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D4942330F; Mon, 6 Feb 2023 09:54:29 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 8BF5B20C7E07; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8BF5B20C7E07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=7SxWZaRpRLxJkUhg+gQA9FOwv6PoAvZB6DyAmUm9xX4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Q9wLcNpOz8ZGPPve2pIs2/ST6BoOd6lBhhZajZAPnMS+ytw9wHYXw8yFavu2FdCMF wna+eGQwi5pQqt49zHhl7NxEtaCeq4qHnu7snTm6c7NbfVblL4hxURk8bnO1Hp7MP/ +owXGaVm49/SdM8erkUEly6/jqm0+jB5w3pDAOOM= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 3/6] Drivers: hv: vmbus: Convert acpi_device to more generic platform_device Date: Mon, 6 Feb 2023 09:54:17 -0800 Message-Id: <1675706060-22361-4-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use more generic platform device instead of acpi device. Also rename the function vmbus_acpi_remove to more generic name vmbus_mmio_remove. Signed-off-by: Saurabh Sengar --- [V3] - Replace to_acpi_device with ACPI_COMPANION which simplify the logic. drivers/hv/vmbus_drv.c | 58 +++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index d24dd65b33d4..9d6e0d02b834 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ struct vmbus_dynid { struct hv_vmbus_device_id id; }; =20 -static struct acpi_device *hv_acpi_dev; +static struct device *hv_dev; =20 static int hyperv_cpuhp_online; =20 @@ -143,7 +144,7 @@ static DEFINE_MUTEX(hyperv_mmio_lock); =20 static int vmbus_exists(void) { - if (hv_acpi_dev =3D=3D NULL) + if (hv_dev =3D=3D NULL) return -ENODEV; =20 return 0; @@ -932,7 +933,7 @@ static int vmbus_dma_configure(struct device *child_dev= ice) * On x86/x64 coherence is assumed and these calls have no effect. */ hv_setup_dma_ops(child_device, - device_get_dma_attr(&hv_acpi_dev->dev) =3D=3D DEV_DMA_COHERENT); + device_get_dma_attr(hv_dev) =3D=3D DEV_DMA_COHERENT); return 0; } =20 @@ -2090,7 +2091,7 @@ int vmbus_device_register(struct hv_device *child_dev= ice_obj) &child_device_obj->channel->offermsg.offer.if_instance); =20 child_device_obj->device.bus =3D &hv_bus; - child_device_obj->device.parent =3D &hv_acpi_dev->dev; + child_device_obj->device.parent =3D hv_dev; child_device_obj->device.release =3D vmbus_device_release; =20 child_device_obj->device.dma_parms =3D &child_device_obj->dma_parms; @@ -2262,7 +2263,7 @@ static acpi_status vmbus_walk_resources(struct acpi_r= esource *res, void *ctx) return AE_OK; } =20 -static void vmbus_acpi_remove(struct acpi_device *device) +static int vmbus_mmio_remove(void) { struct resource *cur_res; struct resource *next_res; @@ -2441,13 +2442,14 @@ void vmbus_free_mmio(resource_size_t start, resourc= e_size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); =20 -static int vmbus_acpi_add(struct acpi_device *device) +static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; int ret_val =3D -ENODEV; struct acpi_device *ancestor; + struct acpi_device *device =3D ACPI_COMPANION(&pdev->dev); =20 - hv_acpi_dev =3D device; + hv_dev =3D &device->dev; =20 /* * Older versions of Hyper-V for ARM64 fail to include the _CCA @@ -2489,10 +2491,21 @@ static int vmbus_acpi_add(struct acpi_device *devic= e) =20 acpi_walk_err: if (ret_val) - vmbus_acpi_remove(device); + vmbus_mmio_remove(); return ret_val; } =20 +static int vmbus_platform_driver_probe(struct platform_device *pdev) +{ + return vmbus_acpi_add(pdev); +} + +static int vmbus_platform_driver_remove(struct platform_device *pdev) +{ + vmbus_mmio_remove(); + return 0; +} + #ifdef CONFIG_PM_SLEEP static int vmbus_bus_suspend(struct device *dev) { @@ -2658,15 +2671,15 @@ static const struct dev_pm_ops vmbus_bus_pm =3D { .restore_noirq =3D vmbus_bus_resume }; =20 -static struct acpi_driver vmbus_acpi_driver =3D { - .name =3D "vmbus", - .ids =3D vmbus_acpi_device_ids, - .ops =3D { - .add =3D vmbus_acpi_add, - .remove =3D vmbus_acpi_remove, - }, - .drv.pm =3D &vmbus_bus_pm, - .drv.probe_type =3D PROBE_FORCE_SYNCHRONOUS, +static struct platform_driver vmbus_platform_driver =3D { + .probe =3D vmbus_platform_driver_probe, + .remove =3D vmbus_platform_driver_remove, + .driver =3D { + .name =3D "vmbus", + .acpi_match_table =3D ACPI_PTR(vmbus_acpi_device_ids), + .pm =3D &vmbus_bus_pm, + .probe_type =3D PROBE_FORCE_SYNCHRONOUS, + } }; =20 static void hv_kexec_handler(void) @@ -2750,12 +2763,11 @@ static int __init hv_acpi_init(void) /* * Get ACPI resources first. */ - ret =3D acpi_bus_register_driver(&vmbus_acpi_driver); - + ret =3D platform_driver_register(&vmbus_platform_driver); if (ret) return ret; =20 - if (!hv_acpi_dev) { + if (!hv_dev) { ret =3D -ENODEV; goto cleanup; } @@ -2785,8 +2797,8 @@ static int __init hv_acpi_init(void) return 0; =20 cleanup: - acpi_bus_unregister_driver(&vmbus_acpi_driver); - hv_acpi_dev =3D NULL; + platform_driver_unregister(&vmbus_platform_driver); + hv_dev =3D NULL; return ret; } =20 @@ -2839,7 +2851,7 @@ static void __exit vmbus_exit(void) =20 cpuhp_remove_state(hyperv_cpuhp_online); hv_synic_free(); - acpi_bus_unregister_driver(&vmbus_acpi_driver); + platform_driver_unregister(&vmbus_platform_driver); } =20 =20 --=20 2.25.1 From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C3A0C05027 for ; Mon, 6 Feb 2023 17:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbjBFRyk (ORCPT ); Mon, 6 Feb 2023 12:54:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbjBFRya (ORCPT ); Mon, 6 Feb 2023 12:54:30 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 32B022331E; Mon, 6 Feb 2023 09:54:29 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id A42E520C7E09; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A42E520C7E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=+ae3h1fqSTbaPsWS3AoeI0ULTZYdKrh7gUDoDE4TJF8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QuaIC7P2t/gA91k1m0a/jA5ddJrqc5gmK9A4PIm8GHeuVf2cqX/nSaS0QNNblO3sm WO8Aw37MKAg5LIqNtyhqpKqa7PxnFZelRj/GSXCFuy7H5UbmfhdERTjYcYyHCrIR8f J2tgqCwBu5xA7eWSIQDel30j0C8bIAccz3pT/hL8= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 4/6] dt-bindings: hypervisor: Rename virtio to hypervisor Date: Mon, 6 Feb 2023 09:54:18 -0800 Message-Id: <1675706060-22361-5-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rename virtio folder to more generic hypervisor, so that this can accommodate more devices of similar type. Signed-off-by: Saurabh Sengar --- [V3] - Fixed compatible schemas error generated in other modules referring to virtio. Documentation/devicetree/bindings/gpio/gpio-virtio.yaml | 4 ++-- .../devicetree/bindings/{virtio =3D> hypervisor}/mmio.yaml | 2 +- .../devicetree/bindings/{virtio =3D> hypervisor}/pci-iommu.yaml | 2 +- .../bindings/{virtio =3D> hypervisor}/virtio-device.yaml | 2 +- Documentation/devicetree/bindings/i2c/i2c-virtio.yaml | 4 ++-- MAINTAINERS | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename Documentation/devicetree/bindings/{virtio =3D> hypervisor}/mmio.yam= l (95%) rename Documentation/devicetree/bindings/{virtio =3D> hypervisor}/pci-iomm= u.yaml (98%) rename Documentation/devicetree/bindings/{virtio =3D> hypervisor}/virtio-d= evice.yaml (93%) diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Docu= mentation/devicetree/bindings/gpio/gpio-virtio.yaml index 601d85754577..e08ed2a1eaa3 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml +++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml @@ -10,10 +10,10 @@ maintainers: - Viresh Kumar =20 allOf: - - $ref: /schemas/virtio/virtio-device.yaml# + - $ref: /schemas/hypervisor/virtio-device.yaml# =20 description: - Virtio GPIO controller, see /schemas/virtio/virtio-device.yaml for more + Virtio GPIO controller, see /schemas/hypervisor/virtio-device.yaml for m= ore details. =20 properties: diff --git a/Documentation/devicetree/bindings/virtio/mmio.yaml b/Documenta= tion/devicetree/bindings/hypervisor/mmio.yaml similarity index 95% rename from Documentation/devicetree/bindings/virtio/mmio.yaml rename to Documentation/devicetree/bindings/hypervisor/mmio.yaml index 0aa8433f0a5e..8492c9b4fec9 100644 --- a/Documentation/devicetree/bindings/virtio/mmio.yaml +++ b/Documentation/devicetree/bindings/hypervisor/mmio.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/mmio.yaml# +$id: http://devicetree.org/schemas/hypervisor/mmio.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 title: virtio memory mapped devices diff --git a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml b/Docu= mentation/devicetree/bindings/hypervisor/pci-iommu.yaml similarity index 98% rename from Documentation/devicetree/bindings/virtio/pci-iommu.yaml rename to Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml index 972a785a42de..52de535fd4ef 100644 --- a/Documentation/devicetree/bindings/virtio/pci-iommu.yaml +++ b/Documentation/devicetree/bindings/hypervisor/pci-iommu.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/pci-iommu.yaml# +$id: http://devicetree.org/schemas/hypervisor/pci-iommu.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 title: virtio-iommu device using the virtio-pci transport diff --git a/Documentation/devicetree/bindings/virtio/virtio-device.yaml b/= Documentation/devicetree/bindings/hypervisor/virtio-device.yaml similarity index 93% rename from Documentation/devicetree/bindings/virtio/virtio-device.yaml rename to Documentation/devicetree/bindings/hypervisor/virtio-device.yaml index 8c6919ba9497..7b8d93b06237 100644 --- a/Documentation/devicetree/bindings/virtio/virtio-device.yaml +++ b/Documentation/devicetree/bindings/hypervisor/virtio-device.yaml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 --- -$id: http://devicetree.org/schemas/virtio/virtio-device.yaml# +$id: http://devicetree.org/schemas/hypervisor/virtio-device.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 title: Virtio device diff --git a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml b/Docume= ntation/devicetree/bindings/i2c/i2c-virtio.yaml index 7d87ed855301..99a0ce203fe1 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml @@ -11,10 +11,10 @@ maintainers: =20 allOf: - $ref: /schemas/i2c/i2c-controller.yaml# - - $ref: /schemas/virtio/virtio-device.yaml# + - $ref: /schemas/hypervisor/virtio-device.yaml# =20 description: - Virtio I2C device, see /schemas/virtio/virtio-device.yaml for more detai= ls. + Virtio I2C device, see /schemas/hypervisor/virtio-device.yaml for more d= etails. =20 properties: $nodename: diff --git a/MAINTAINERS b/MAINTAINERS index f76ca2808474..27a5650a9ffd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21977,7 +21977,7 @@ L: virtualization@lists.linux-foundation.org S: Maintained F: Documentation/ABI/testing/sysfs-bus-vdpa F: Documentation/ABI/testing/sysfs-class-vduse -F: Documentation/devicetree/bindings/virtio/ +F: Documentation/devicetree/bindings/hypervisor/ F: Documentation/driver-api/virtio/ F: drivers/block/virtio_blk.c F: drivers/crypto/virtio/ --=20 2.25.1 From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B803FC05027 for ; Mon, 6 Feb 2023 17:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230349AbjBFRyq (ORCPT ); Mon, 6 Feb 2023 12:54:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjBFRyb (ORCPT ); Mon, 6 Feb 2023 12:54:31 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2139D22A17; Mon, 6 Feb 2023 09:54:30 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id BD0B320C7E21; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BD0B320C7E21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=aAEQsXw93ASVLNaj7yldD7WcYztof31LvCytxSCKKmI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W8gN2mOjF3uwDunFwChQrdlECU8hWzhSk3cn7vJL4Mcv2FfwuHY0RVmN83MjQ/Vnj Xv+7cT1Zl1LyItpBfliNqE4UxBpSj4w8oisGhSbWK48IUHGHdEhEmgLlvX3tQOeu+o YLtk1IW+vetdfR4DY1wRaEVOyXMVWEghkteDnv5w= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 5/6] dt-bindings: hypervisor: VMBus Date: Mon, 6 Feb 2023 09:54:19 -0800 Message-Id: <1675706060-22361-6-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add dt-bindings for Hyper-V VMBus. Signed-off-by: Saurabh Sengar --- [V3] - Removed "device tree bindings" from title and patch subject. - Removed duplicate vendor prefix, used microsoft instead of msft. - Drop hex notation and leading zeros from device tree cell properties. - Use 'soc' in example of device tree documantation for parent node. .../bindings/hypervisor/microsoft,vmbus.yaml | 48 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/hypervisor/microsoft,= vmbus.yaml diff --git a/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.y= aml b/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml new file mode 100644 index 000000000000..a9c43a626df4 --- /dev/null +++ b/Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hypervisor/microsoft,vmbus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microsoft Hyper-V VMBus + +maintainers: + - Saurabh Sengar + +description: + VMBus is a software bus that implement the protocols for communication + between the root or host OS and guest OSs (virtual machines). + +properties: + compatible: + const: microsoft,vmbus + + ranges: true + + '#address-cells': + const: 2 + + '#size-cells': + const: 1 + +required: + - compatible + - ranges + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + + vmbus@ff0000000 { + #address-cells =3D <2>; + #size-cells =3D <1>; + compatible =3D "microsoft,vmbus"; + ranges =3D <0x0f 0xf0000000 0x0f 0xf0000000 0x10000000>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 27a5650a9ffd..669f1c147bcb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9490,6 +9490,7 @@ S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git F: Documentation/ABI/stable/sysfs-bus-vmbus F: Documentation/ABI/testing/debugfs-hyperv +F: Documentation/devicetree/bindings/hypervisor/microsoft,vmbus.yaml F: Documentation/virt/hyperv F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst F: arch/arm64/hyperv --=20 2.25.1 From nobody Sat Sep 13 01:30:36 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DCCBC63797 for ; Mon, 6 Feb 2023 17:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbjBFRyn (ORCPT ); Mon, 6 Feb 2023 12:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbjBFRyb (ORCPT ); Mon, 6 Feb 2023 12:54:31 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1FAB61F5C8; Mon, 6 Feb 2023 09:54:30 -0800 (PST) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id D541120C7E22; Mon, 6 Feb 2023 09:54:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D541120C7E22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1675706068; bh=kv/i0skTIQvHGuOqg6IvE4yvIUe6D8o/sc/yx8wo9AU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BVltVqViESplLS404Ok1Qrd5iAX1ruwM2n6LtmSJgotsz/yEYoGnyHy/m6Hq1GTyy Xp0ER8LUH1tTpMykd+Nhhpji+bYaK3Y76F09nc5APehvUv1Q5E7q4C8CU6ZAlNnsao PkFl7FLs71r1RVwAfer35+pvhgzSqsilt7JCsAUk= From: Saurabh Sengar To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, daniel.lezcano@linaro.org, tglx@linutronix.de, virtualization@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, ssengar@microsoft.com, dphadke@linux.microsoft.com Subject: [PATCH v3 6/6] Driver: VMBus: Add device tree support Date: Mon, 6 Feb 2023 09:54:20 -0800 Message-Id: <1675706060-22361-7-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> References: <1675706060-22361-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update the driver to support device tree boot as well along with ACPI. At present the device tree parsing only provides the mmio region info and is not the exact copy of ACPI parsing. This is sufficient to cater all the current device tree usecases for VMBus. Currently device tree is supported only for x86 systems. Signed-off-by: Saurabh Sengar --- [V3] - Changed the logic to use generic api (for_each_of_range) for parsing "ran= ges". - Remove dependency of ACPI for HYPERV in case of x86. drivers/hv/Kconfig | 4 +-- drivers/hv/vmbus_drv.c | 60 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 0747a8f1fcee..7e44d4246d8d 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -4,8 +4,8 @@ menu "Microsoft Hyper-V guest support" =20 config HYPERV tristate "Microsoft Hyper-V client drivers" - depends on ACPI && ((X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \ - || (ARM64 && !CPU_BIG_ENDIAN)) + depends on (X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \ + || (ACPI && ARM64 && !CPU_BIG_ENDIAN) select PARAVIRT select X86_HV_CALLBACK_VECTOR if X86 select VMAP_PFN diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 9d6e0d02b834..5cbc541a20b5 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -2152,7 +2153,7 @@ void vmbus_device_unregister(struct hv_device *device= _obj) device_unregister(&device_obj->device); } =20 - +#ifdef CONFIG_ACPI /* * VMBUS is an acpi enumerated device. Get the information we * need from DSDT. @@ -2262,6 +2263,7 @@ static acpi_status vmbus_walk_resources(struct acpi_r= esource *res, void *ctx) =20 return AE_OK; } +#endif =20 static int vmbus_mmio_remove(void) { @@ -2282,7 +2284,7 @@ static int vmbus_mmio_remove(void) } } =20 -static void vmbus_reserve_fb(void) +static void __maybe_unused vmbus_reserve_fb(void) { resource_size_t start =3D 0, size; struct pci_dev *pdev; @@ -2442,6 +2444,7 @@ void vmbus_free_mmio(resource_size_t start, resource_= size_t size) } EXPORT_SYMBOL_GPL(vmbus_free_mmio); =20 +#ifdef CONFIG_ACPI static int vmbus_acpi_add(struct platform_device *pdev) { acpi_status result; @@ -2494,10 +2497,52 @@ static int vmbus_acpi_add(struct platform_device *p= dev) vmbus_mmio_remove(); return ret_val; } +#else + +static int vmbus_device_add(struct platform_device *pdev) +{ + struct resource **cur_res =3D &hyperv_mmio; + struct of_range range; + struct of_range_parser parser; + struct device_node *np; + int ret =3D 0; + + hv_dev =3D &pdev->dev; + np =3D pdev->dev.of_node; + + ret =3D of_range_parser_init(&parser, np); + if (ret) { + dev_err(hv_dev, "Failed to parse resources.\n"); + return ret; + } + + for_each_of_range(&parser, &range) { + struct resource *res; + + res =3D kzalloc(sizeof(*res), GFP_ATOMIC); + if (!res) + return -ENOMEM; + + res->name =3D "hyperv mmio"; + res->flags =3D IORESOURCE_MEM | IORESOURCE_MEM_64; + res->start =3D range.pci_addr; + res->end =3D range.pci_addr + range.size; + + *cur_res =3D res; + cur_res =3D &res->sibling; + } + + return ret; +} +#endif =20 static int vmbus_platform_driver_probe(struct platform_device *pdev) { +#ifdef CONFIG_ACPI return vmbus_acpi_add(pdev); +#else + return vmbus_device_add(pdev); +#endif } =20 static int vmbus_platform_driver_remove(struct platform_device *pdev) @@ -2643,6 +2688,16 @@ static int vmbus_bus_resume(struct device *dev) #define vmbus_bus_resume NULL #endif /* CONFIG_PM_SLEEP */ =20 +static const struct of_device_id vmbus_of_match[] =3D { + { + .compatible =3D "microsoft,vmbus", + }, + { + /* sentinel */ + }, +}; +MODULE_DEVICE_TABLE(of, vmbus_of_match); + static const struct acpi_device_id vmbus_acpi_device_ids[] =3D { {"VMBUS", 0}, {"VMBus", 0}, @@ -2677,6 +2732,7 @@ static struct platform_driver vmbus_platform_driver = =3D { .driver =3D { .name =3D "vmbus", .acpi_match_table =3D ACPI_PTR(vmbus_acpi_device_ids), + .of_match_table =3D of_match_ptr(vmbus_of_match), .pm =3D &vmbus_bus_pm, .probe_type =3D PROBE_FORCE_SYNCHRONOUS, } --=20 2.25.1