Skip to contentSkip to conversation

use proper address translation functions in Dell RBU

PATCH In review Jan Beulich 2 participants 2 messages Nov 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use proper address translation functions in Dell RBU

virt_to_bus() ought to be used (in particular for Xen compatibility).

---
 drivers/firmware/dell_rbu.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/dell_rbu.c +4 -4
@@ -170,7 +170,7 @@ static int create_packet(void *data, siz
 			goto out_alloc_packet_array;
 		}
 
-		if ((unsigned long)virt_to_phys(packet_data_temp_buf)
+		if ((unsigned long)virt_to_bus(packet_data_temp_buf)
 				< allocation_floor) {
 			pr_debug("packet 0x%lx below floor at 0x%lx.\n",
 					(unsigned long)virt_to_phys(
@@ -185,7 +185,7 @@ static int create_packet(void *data, siz
 	newpacket->data = packet_data_temp_buf;
 
 	pr_debug("create_packet: newpacket at physical addr %lx\n",
-		(unsigned long)virt_to_phys(newpacket->data));
+		(unsigned long)virt_to_bus(newpacket->data));
 
 	/* packets may not have fixed size */
 	newpacket->length = length;
@@ -204,7 +204,7 @@ out_alloc_packet_array:
 	/* always free packet array */
 	for (;idx>0;idx--) {
 		pr_debug("freeing unused packet below floor 0x%lx.\n",
-			(unsigned long)virt_to_phys(
+			(unsigned long)virt_to_bus(
 				invalid_addr_packet_array[idx-1]));
 		free_pages((unsigned long)invalid_addr_packet_array[idx-1],
 			ordernum);
@@ -438,7 +438,7 @@ static int img_update_realloc(unsigned l
 		(unsigned char *) __get_free_pages(GFP_KERNEL, ordernum);
 
 	img_buf_phys_addr =
-		(unsigned long) virt_to_phys(image_update_buffer);
+		(unsigned long) virt_to_bus(image_update_buffer);
 
 	if (img_buf_phys_addr > BIOS_SCAN_LIMIT) {
 		free_pages((unsigned long) image_update_buffer, ordernum);
#1 lore raw
Quoted 1 line · On Fri, 20 Nov 2009 13:46:46 +0000 "Jan Beulich" <[email protected]> wrote:

virt_to_bus() ought to be used (in particular for Xen compatibility).

This seems a bit odd - the addresses are memory physical addresses and are accessed by the firmware not by external device logic. So I think this is a Xen bug, the kernel code appears to be correct.

Alan