Skip to contentSkip to conversation

iSCSI/iBFT: use proper address translation

PATCH In review Jan Beulich 4 participants 8 messages Oct 1, 2009 – Oct 2, 2009 iSCSI boot firmware table (iBFT) driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iSCSI/iBFT: use proper address translation

In virtual environments (namely, Xen Dom0) virt <-> phys and virt <-> isa-bus translations cannot be freely interchanged. When looking at memory below 1M, the latter translations should always be used.

iscsi_ibft_find.c part from: Martin Wilck <[email protected]>.

Cc Jeremy Fitzhardinge <[email protected]>
---
 drivers/firmware/iscsi_ibft.c      |    2 +-
 drivers/firmware/iscsi_ibft_find.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/iscsi_ibft.c +1 -1
@@ -939,7 +939,7 @@ static int __init ibft_init(void)
 
 	if (ibft_addr) {
 		printk(KERN_INFO "iBFT detected at 0x%llx.\n",
-		       (u64)virt_to_phys((void *)ibft_addr));
+		       (u64)isa_virt_to_bus(ibft_addr));
 
 		rc = ibft_check_device();
 		if (rc)
drivers/firmware/iscsi_ibft_find.c +2 -2
@@ -65,10 +65,10 @@ void __init reserve_ibft_region(void)
 		 * so skip that area */
 		if (pos == VGA_MEM)
 			pos += VGA_SIZE;
-		virt = phys_to_virt(pos);
+		virt = isa_bus_to_virt(pos);
 		if (memcmp(virt, IBFT_SIGN, IBFT_SIGN_LEN) == 0) {
 			unsigned long *addr =
-			    (unsigned long *)phys_to_virt(pos + 4);
+			    (unsigned long *)isa_bus_to_virt(pos + 4);
 			len = *addr;
 			/* if the length of the table extends past 1M,
 			 * the table cannot be valid. */
maintainer
#1 lore raw
Quoted 9 lines · Jan Beulich

In virtual environments (namely, Xen Dom0) virt <-> phys and virt <-> isa-bus translations cannot be freely interchanged. When looking at memory below 1M, the latter translations should always be used.

iscsi_ibft_find.c part from: Martin Wilck <[email protected]>.

Cc Jeremy Fitzhardinge <[email protected]>

Looks good to me.

Quoted 35 lines
---
 drivers/firmware/iscsi_ibft.c      |    2 +-
 drivers/firmware/iscsi_ibft_find.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/iscsi_ibft.c +1 -1
@@ -939,7 +939,7 @@ static int __init ibft_init(void)
 
 	if (ibft_addr) {
 		printk(KERN_INFO "iBFT detected at 0x%llx.\n",
-		       (u64)virt_to_phys((void *)ibft_addr));
+		       (u64)isa_virt_to_bus(ibft_addr));
 
 		rc = ibft_check_device();
 		if (rc)
drivers/firmware/iscsi_ibft_find.c +2 -2
@@ -65,10 +65,10 @@ void __init reserve_ibft_region(void)
 		 * so skip that area */
 		if (pos == VGA_MEM)
 			pos += VGA_SIZE;
-		virt = phys_to_virt(pos);
+		virt = isa_bus_to_virt(pos);
 		if (memcmp(virt, IBFT_SIGN, IBFT_SIGN_LEN) == 0) {
 			unsigned long *addr =
-			    (unsigned long *)phys_to_virt(pos + 4);
+			    (unsigned long *)isa_bus_to_virt(pos + 4);
 			len = *addr;
 			/* if the length of the table extends past 1M,
 			 * the table cannot be valid. */
Signature · 4 lines
        Peter

When privacy is outlawed only outlaws will have privacy.
		-- Zimmermann
#2 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

In virtual environments (namely, Xen Dom0) virt <-> phys and virt <-> isa-bus translations cannot be freely interchanged. When looking at memory below 1M, the latter translations should always be used.

Do you have a different definition for isa_virt_to_bus in your kernel? As far as I can see it is defined to be the same as virt_to_phys. Also, the ISA memory is identity mapped into the domain's physical mapping space, so it should be directly accessible without any problems.

J

#3 lore raw
Quoted 11 lines · Jeremy Fitzhardinge
Quoted 5 lines · Jan Beulich

In virtual environments (namely, Xen Dom0) virt <-> phys and virt <-> isa-bus translations cannot be freely interchanged. When looking at memory below 1M, the latter translations should always be used.

Do you have a different definition for isa_virt_to_bus in your kernel? As far as I can see it is defined to be the same as virt_to_phys. Also, the ISA memory is identity mapped into the domain's physical mapping space, so it should be directly accessible without any problems.

The issue as I've come to understand is that the virt_to_phys on memory below the 1MB does not work. Alex suggested another fix which ioremap's the iBFT region, but I think this patch by Martin does the same job.

Either way, it looks good to me.

#4 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Konrad Rzeszutek <[email protected]> 02.10.09 03:28 >>>

The issue as I've come to understand is that the virt_to_phys on memory below the 1MB does not work. Alex suggested another fix which ioremap's the iBFT region, but I think this patch by Martin does the same job.

Either way, it looks good to me.

With both ofyou having signed off on it - who's going to push this to Linus? I'm specifically asking in case I'm expected to.

Jan

maintainer
#5 lore raw
Quoted 11 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Konrad Rzeszutek<[email protected]> 02.10.09 03:28>>>

The issue as I've come to understand is that the virt_to_phys on memory below the 1MB does not work. Alex suggested another fix which ioremap's the iBFT region, but I think this patch by Martin does the same job.

Either way, it looks good to me.

With both ofyou having signed off on it - who's going to push this to Linus? I'm specifically asking in case I'm expected to.

Not sure how that's supposed to work, but I'm cool with you doing it ;)

#6 lore raw
Quoted 7 lines · Peter Jones
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line

Konrad Rzeszutek<[email protected]> 02.10.09 03:28>>>

The issue as I've come to understand is that the virt_to_phys on memory below the 1MB does not work. Alex suggested another fix which ioremap's the iBFT region, but I think this patch by Martin does the same job.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Either way, it looks good to me.

With both ofyou having signed off on it - who's going to push this to Linus? I'm specifically asking in case I'm expected to.

Not sure how that's supposed to work, but I'm cool with you doing it ;)

Yeah me too :-)

P.S.
In the past I pushed it off to Greg KH and/or Mike Christie.

#7 lore raw
In reply to Jeremy Fitzhardinge
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Jeremy Fitzhardinge <[email protected]> 01.10.09 23:46 >>>

Quoted 5 lines · Jan Beulich

In virtual environments (namely, Xen Dom0) virt <-> phys and virt <-> isa-bus translations cannot be freely interchanged. When looking at memory below 1M, the latter translations should always be used.

Quoted 4 lines

Do you have a different definition for isa_virt_to_bus in your kernel? As far as I can see it is defined to be the same as virt_to_phys. Also, the ISA memory is identity mapped into the domain's physical mapping space, so it should be directly accessible without any problems.

I wasn't sure if this is an issue in the pv-ops kernel, so I copied you just in case. Yes, we do have a different virt<->isa_bus translation, but the point of the patch really is that virt<->phys translations are incorrectly being used here regardless of the underlying environment.

Jan