2023-06-01 17:29:42

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH v2] iscsi_ibft: Fix finding the iBFT under Xen Dom 0

On 5/30/23 08:01, Ross Lagerwall wrote:
> Since firmware doesn't indicate the iBFT in the E820, add a reserved
> region so that it gets identity mapped when running as Dom 0 so that it
> is possible to search for it. Move the call to reserve_ibft_region()
> later so that it is called after the Xen identity mapping adjustments
> are applied.
>
> Finally, instead of using isa_bus_to_virt() which doesn't do the right
> thing under Xen, use early_memremap() like the dmi_scan code does.

This is connecting Xen, iSCSI and x86. Some background here would be
*really* nice for dummies like me that deal heavily in only one of those
three.

One or two sentences like this:

Firmware can provide an iSCSI-specific table called the iBFT
which helps the OS boot from iSCSI devices.

can go a long way for dummies like me. As could some background about
why this:

... add a reserved region so that it gets identity mapped when
running as Dom 0 so that it is possible to search for it.

These are all English words, but off the top of my head, I have no idea
why reserved regions get identity mapped when running as Dom 0 or why
that makes it possible to search.

The addresses and size here:

> +#ifdef CONFIG_ISCSI_IBFT_FIND
> + /* Reserve 0.5 MiB to 1 MiB region so iBFT can be found */
> + xen_e820_table.entries[xen_e820_table.nr_entries].addr = 0x80000;
> + xen_e820_table.entries[xen_e820_table.nr_entries].size = 0x80000;
> + xen_e820_table.entries[xen_e820_table.nr_entries].type = E820_TYPE_RESERVED;
> + xen_e820_table.nr_entries++;
> +#endif

also appear to be conjured out of thin air.

As does the move of:

> + reserve_ibft_region();

I'm sure I can go figure this all out with some research. But, I'd
really appreciate some extra effort from you in this changelog to save
me the time. I bet you can explain it a lot more efficiently than I can
go figure it out.


2023-06-01 17:54:32

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH v2] iscsi_ibft: Fix finding the iBFT under Xen Dom 0

On 6/1/23 09:57, Dave Hansen wrote:
> On 5/30/23 08:01, Ross Lagerwall wrote:
>> Since firmware doesn't indicate the iBFT in the E820, add a reserved
>> region so that it gets identity mapped when running as Dom 0 so that it
>> is possible to search for it. Move the call to reserve_ibft_region()
>> later so that it is called after the Xen identity mapping adjustments
>> are applied.

Oh, and one more thing:

What is the end user visible effect of this problem and of your solution?

Do Xen Dom 0 systems fail to find their boot iSCSI volume and refuse to
boot? I take it after this patch that they can boot again.

2023-06-02 06:07:41

by Jürgen Groß

[permalink] [raw]
Subject: Re: [PATCH v2] iscsi_ibft: Fix finding the iBFT under Xen Dom 0

On 01.06.23 18:57, Dave Hansen wrote:
> On 5/30/23 08:01, Ross Lagerwall wrote:
>> Since firmware doesn't indicate the iBFT in the E820, add a reserved
>> region so that it gets identity mapped when running as Dom 0 so that it
>> is possible to search for it. Move the call to reserve_ibft_region()
>> later so that it is called after the Xen identity mapping adjustments
>> are applied.
>>
>> Finally, instead of using isa_bus_to_virt() which doesn't do the right
>> thing under Xen, use early_memremap() like the dmi_scan code does.
>
> This is connecting Xen, iSCSI and x86. Some background here would be
> *really* nice for dummies like me that deal heavily in only one of those
> three.
>
> One or two sentences like this:
>
> Firmware can provide an iSCSI-specific table called the iBFT
> which helps the OS boot from iSCSI devices.
>
> can go a long way for dummies like me. As could some background about
> why this:
>
> ... add a reserved region so that it gets identity mapped when
> running as Dom 0 so that it is possible to search for it.
>
> These are all English words, but off the top of my head, I have no idea
> why reserved regions get identity mapped when running as Dom 0 or why
> that makes it possible to search.
>
> The addresses and size here:
>
>> +#ifdef CONFIG_ISCSI_IBFT_FIND
>> + /* Reserve 0.5 MiB to 1 MiB region so iBFT can be found */
>> + xen_e820_table.entries[xen_e820_table.nr_entries].addr = 0x80000;
>> + xen_e820_table.entries[xen_e820_table.nr_entries].size = 0x80000;
>> + xen_e820_table.entries[xen_e820_table.nr_entries].type = E820_TYPE_RESERVED;
>> + xen_e820_table.nr_entries++;
>> +#endif
>
> also appear to be conjured out of thin air.

I'd suggest to move the definitions of IBFT_START and IBFT_END from
drivers/firmware/iscsi_ibft_find.c to include/linux/iscsi_ibft.h and use
them here.


Juergen


Attachments:
OpenPGP_0xB0DE9DD628BF132F.asc (3.08 kB)
OpenPGP public key
OpenPGP_signature (505.00 B)
OpenPGP digital signature
Download all attachments