[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ns16550: enable memory decoding on MMIO-based PCI console card


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 25 Apr 2023 11:37:47 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3ATNNVVqOrdW2aZ7VmVeCVcEoEOy2KfvMGzUwlyIuyQ=; b=ctZH0H5Cc2ov4nSmJ27CE6NJu7hTa0zWZJPH2GUMZNyNiFT/eLTSb+RnFhYA4LAvBysBgoU6eArloVIGHi2rzeaanU8PEOFSAvFEGa8ddLlt1wvlB6/0ws+vaRaZgyniGIIkDMjZsonm2zQeqBM6Ardw/HSJbxEUu1REv/gt8MlJYwMN1lsCgBTnrvZb+nbO0/eF4UCQYP03DcBX+uEkWY5uBChHRhVKbgCHbDGiqUp2AmJBlygmFuiw9yh1eSy0Y+xDYMk47awBWTpLH2//26oN113D/Gpp1JWYcJEdraw5s0/W4AkYgGKV6kiyTJXK8p9wlzM2jcg/dkTjW+X4Rg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OD2hcd+NEEGgFa02CRbSsnvk3yMWF/c2Yu1mSOrwzPj/gRimpox3FIFF1Y5n28eFhnKr7nFbHC15QCIqlqmp9Z6Vtgd5bo7SCdq2q21sBKSNaXpAhFeWZwLD1vY2ntzpbuZtgvZIqH2d4I1d+4KEpuyrPu+92zebLzGvFDZO/9M5vX10gImwepll/ySBta3skOzTC18ZV8UpVc4PuT2A6KbkkJdIGOQ/8k+i0TJjFifj2/DO26Hp8COIreG5ecTdqKPg75fySkgpg1Q0kXA5i5I2rtkSVrESIUmoFFRCL9gMUucbir1a9QzujQkVOqXusc14295AYSa87ZqoqARi5Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 25 Apr 2023 09:38:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.04.2023 11:22, Marek Marczykowski-Górecki wrote:
> On Tue, Apr 25, 2023 at 10:05:25AM +0200, Jan Beulich wrote:
>> On 25.04.2023 01:39, Marek Marczykowski-Górecki wrote:
>>> pci_serial_early_init() enables PCI_COMMAND_IO for IO-based UART
>>> devices, do similar with PCI_COMMAND_MEMORY for MMIO-based UART devices.
>>
>> While I agree that something like this is needed (and in fact I have been
>> wondering more than once why this wasn't there), what you say above isn't
>> really correct imo: You do not really make things similar to port-based
>> handling. For one you don't respect uart->pb_bdf_enable. And then you also
>> don't write the BAR. When you use the BDF form of com<N>=, I don't see how
>> else the BAR could be written to the value that you (necessarily) have to
>> also specify on the command line. 
> 
> I don't think MMIO-based UART is going to work without "pci" on the
> command line at all. Setting the BAR is one of the reasons (there is
> more to it than just setting (or reading) PCI_BASE_ADDRESS_0, as many
> cards have UART registers at an offset), but also other parameters like
> fifo_size. So, I don't think it's a good idea to set PCI_BASE_ADDRESS_0
> to what user provided in io_base.

While the BDF way of setting the device to use is meant for the most basic
configurations only anyway, I'm okay with you to leave out that aspect as
well, so long as you mention it as (another) dissimilarity with the port-
based logic.

>> As said on Matrix, using the "pci"
>> sub-option together with the BDF one isn't intended (and would probably
>> better be rejected), according to all I can tell. Which in turn means that
>> for the "pci" sub-option alone to also have the effect of - if necessary -
>> enabling I/O or memory decoding, a further adjustment would be needed
>> (because merely keying this to uart->ps_bdf_enable then isn't enough). I
>> guess like e.g. ns16550_init_postirq() you'd want to also check uart->bar.
> 
> Yes, checking also uart->bar makes sense.
> 
>> That said, I'm not meaning to mandate you to particularly deal with the
>> bridge part of the setup, not the least because I consider bogus what we
>> have. But you should at least mention in the description what you leave
>> untouched (and hence dissimilar to port-based handling).
>>
>> As to rejecting invalid combinations of sub-options: See e.g. the dev_set
>> variable in parse_namevalue_pairs(). That's a wee attempt to go in the
>> intended direction.
> 
> That makes sense with the current code shape. At some point IMO it's
> worth having an option to choose which PCI device to use, also for
> MMIO-based cards, but I don't have a need for this feature right now.

Well, in a very limited way this is already possible - see pci_uart_config()'s
"idx" parameter. The primary thing needed is extending ns16550_com[] to more
than two entries, or introducing a suitable level of indirection.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.