linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Saurabh Sengar <ssengar@linux.microsoft.com>
Cc: 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, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	mikelley@microsoft.com, lenb@kernel.org, rafael@kernel.org,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH v7 5/5] Driver: VMBus: Add Devicetree support
Date: Thu, 9 Mar 2023 21:16:25 +0000	[thread overview]
Message-ID: <ZApMqWPWgWXIju/g@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <1677151745-16521-6-git-send-email-ssengar@linux.microsoft.com>

On Thu, Feb 23, 2023 at 03:29:05AM -0800, Saurabh Sengar wrote:
[...]
> +#ifdef CONFIG_ACPI
>  static int vmbus_acpi_add(struct platform_device *pdev)
>  {
>  	acpi_status result;
> @@ -2494,10 +2497,47 @@ static int vmbus_acpi_add(struct platform_device *pdev)
>  		vmbus_mmio_remove();
>  	return ret_val;
>  }
> +#endif
> +
> +static int vmbus_device_add(struct platform_device *pdev)
> +{
> +	struct resource **cur_res = &hyperv_mmio;
> +	struct of_range range;
> +	struct of_range_parser parser;
> +	struct device_node *np = pdev->dev.of_node;
> +	int ret;
> +
> +	hv_dev = &pdev->dev;
> +
> +	ret = of_range_parser_init(&parser, np);
> +	if (ret)
> +		return ret;
> +
> +	for_each_of_range(&parser, &range) {
> +		struct resource *res;
> +
> +		res = kzalloc(sizeof(*res), GFP_ATOMIC);

Why GFP_ATOMIC here? I don't think this function will be called in
atomic context, right?

> +		if (!res)
> +			return -ENOMEM;
> +
> +		res->name = "hyperv mmio";
> +		res->flags = IORESOURCE_MEM | IORESOURCE_MEM_64;

Are you sure IORESOURCE_MEM_64 is correct or required? The ACPI method
does not set this flag.

> +		res->start = range.cpu_addr;
> +		res->end = range.cpu_addr + range.size;
> +
> +		*cur_res = res;
> +		cur_res = &res->sibling;
> +	}
> +
> +	return ret;
> +}
>  
>  static int vmbus_platform_driver_probe(struct platform_device *pdev)
>  {
> +#ifdef CONFIG_ACPI
>  	return vmbus_acpi_add(pdev);
> +#endif

Please use #else here.

> +	return vmbus_device_add(pdev);

Is there going to be a configuration that ACPI and OF are available at
the same time? I don't see they are marked as mutually exclusive in the
proposed KConfig.

Thanks,
Wei.

>  }
>  
>  static int vmbus_platform_driver_remove(struct platform_device *pdev)
> @@ -2643,12 +2683,24 @@ static int vmbus_bus_resume(struct device *dev)
>  #define vmbus_bus_resume NULL
>  #endif /* CONFIG_PM_SLEEP */
>  
> +static const __maybe_unused struct of_device_id vmbus_of_match[] = {
> +	{
> +		.compatible = "microsoft,vmbus",
> +	},
> +	{
> +		/* sentinel */
> +	},
> +};
> +MODULE_DEVICE_TABLE(of, vmbus_of_match);
> +
> +#ifdef CONFIG_ACPI
>  static const struct acpi_device_id vmbus_acpi_device_ids[] = {
>  	{"VMBUS", 0},
>  	{"VMBus", 0},
>  	{"", 0},
>  };
>  MODULE_DEVICE_TABLE(acpi, vmbus_acpi_device_ids);
> +#endif
>  
>  /*
>   * Note: we must use the "no_irq" ops, otherwise hibernation can not work with
> @@ -2677,6 +2729,7 @@ static struct platform_driver vmbus_platform_driver = {
>  	.driver = {
>  		.name = "vmbus",
>  		.acpi_match_table = ACPI_PTR(vmbus_acpi_device_ids),
> +		.of_match_table = of_match_ptr(vmbus_of_match),
>  		.pm = &vmbus_bus_pm,
>  		.probe_type = PROBE_FORCE_SYNCHRONOUS,
>  	}
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-03-09 21:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 11:29 [PATCH v7 0/5] Device tree support for Hyper-V VMBus driver Saurabh Sengar
2023-02-23 11:29 ` [PATCH v7 1/5] drivers/clocksource/hyper-v: non ACPI support in hyperv clock Saurabh Sengar
2023-02-23 11:29 ` [PATCH v7 2/5] ACPI: bus: Add stub acpi_sleep_state_supported() in non-ACPI cases Saurabh Sengar
2023-02-23 11:29 ` [PATCH v7 3/5] Drivers: hv: vmbus: Convert acpi_device to more generic platform_device Saurabh Sengar
2023-02-23 11:29 ` [PATCH v7 4/5] dt-bindings: bus: VMBus Saurabh Sengar
2023-03-06  7:49   ` Saurabh Singh Sengar
2023-03-08 18:53   ` Rob Herring
2023-02-23 11:29 ` [PATCH v7 5/5] Driver: VMBus: Add Devicetree support Saurabh Sengar
2023-03-09 21:16   ` Wei Liu [this message]
2023-03-10  5:34     ` Saurabh Singh Sengar
2023-03-12 13:08       ` Michael Kelley (LINUX)
2023-03-12 17:39         ` Saurabh Singh Sengar
2023-03-13  2:27           ` Michael Kelley (LINUX)
2023-03-13  2:33   ` Michael Kelley (LINUX)
2023-03-13  6:16     ` Saurabh Singh Sengar
2023-03-13 12:26       ` Michael Kelley (LINUX)
2023-03-13 13:37         ` Saurabh Singh Sengar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZApMqWPWgWXIju/g@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=decui@microsoft.com \
    --cc=devicetree@vger.kernel.org \
    --cc=haiyangz@microsoft.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kys@microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).