Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-28 Thread Muli Ben-Yehuda
On Tue, Oct 28, 2008 at 06:21:35PM +0200, Avi Kivity wrote:
> Muli Ben-Yehuda wrote:
>
>  
>>> Well, what is this needed for in the first place?
>>> 
>>
>> This specific function is not used. I assume Amit added it for
>> completeness with piix_get_irq. piix_get_irq, as far as I can tell, is
>> used in only one place (when the guest updates a device's
>> configuration space interrupt register) to go from interrupt pin
>> (intx) to guest IRQ line.
>>   
>
> In that case, a solution suggests itself...

Yes, of course! I don't know how I missed it!

Err...

What is it?

Seriously, I removed piix3_get_pin as soon as I noticed it wasn't
actually used, but I am not convinced that there are no aliasing
issues remaining with piix_get_irq---most likely because I do not
understand PCI interrupt routing to any sufficient degree. Do you see
problems remaining with pixx_get_irq?

Cheers,
Muli
-- 
The First Workshop on I/O Virtualization (WIOV '08)
Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/
   <->
SYSTOR 2009---The Israeli Experimental Systems Conference
http://www.haifa.il.ibm.com/conferences/systor2009/
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-28 Thread Avi Kivity

Muli Ben-Yehuda wrote:

 


Well, what is this needed for in the first place?



This specific function is not used. I assume Amit added it for
completeness with piix_get_irq. piix_get_irq, as far as I can tell, is
used in only one place (when the guest updates a device's
configuration space interrupt register) to go from interrupt pin
(intx) to guest IRQ line.
  


In that case, a solution suggests itself...

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-28 Thread Muli Ben-Yehuda
On Tue, Oct 28, 2008 at 12:46:39PM +0200, Avi Kivity wrote:
> Muli Ben-Yehuda wrote:
>> On Sun, Oct 26, 2008 at 03:31:24PM +0200, Avi Kivity wrote:
>>   
>>> Amit Shah wrote:
>>> 
  +int piix3_get_pin(int pic_irq)
 +{
 +int i;
 +for (i = 0; i < 4; i++)
 +if (piix3_dev->config[0x60+i] == pic_irq)
 +return i;
 +return -1;
 +}
 
>>> What happens if two pci interrupts are routed to one irq line?
>>> 
>>
>> This one I'm still thinking about.
>>   
>
> Well, what is this needed for in the first place?

This specific function is not used. I assume Amit added it for
completeness with piix_get_irq. piix_get_irq, as far as I can tell, is
used in only one place (when the guest updates a device's
configuration space interrupt register) to go from interrupt pin
(intx) to guest IRQ line.

Cheers,
Muli
-- 
The First Workshop on I/O Virtualization (WIOV '08)
Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/
   <->
SYSTOR 2009---The Israeli Experimental Systems Conference
http://www.haifa.il.ibm.com/conferences/systor2009/
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-28 Thread Avi Kivity

Muli Ben-Yehuda wrote:

On Sun, Oct 26, 2008 at 03:31:24PM +0200, Avi Kivity wrote:
  

Amit Shah wrote:


 +int piix3_get_pin(int pic_irq)
+{
+int i;
+for (i = 0; i < 4; i++)
+if (piix3_dev->config[0x60+i] == pic_irq)
+return i;
+return -1;
+}
  
  

What happens if two pci interrupts are routed to one irq line?



This one I'm still thinking about.
  


Well, what is this needed for in the first place?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-28 Thread Muli Ben-Yehuda
On Sun, Oct 26, 2008 at 03:31:24PM +0200, Avi Kivity wrote:
> Amit Shah wrote:
>>  +int piix3_get_pin(int pic_irq)
>> +{
>> +int i;
>> +for (i = 0; i < 4; i++)
>> +if (piix3_dev->config[0x60+i] == pic_irq)
>> +return i;
>> +return -1;
>> +}
>>   
>
> What happens if two pci interrupts are routed to one irq line?

This one I'm still thinking about.

Cheers,
Muli
-- 
The First Workshop on I/O Virtualization (WIOV '08)
Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/
   <->
SYSTOR 2009---The Israeli Experimental Systems Conference
http://www.haifa.il.ibm.com/conferences/systor2009/
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-26 Thread Avi Kivity

Amit Shah wrote:
 
+int piix3_get_pin(int pic_irq)

+{
+int i;
+for (i = 0; i < 4; i++)
+if (piix3_dev->config[0x60+i] == pic_irq)
+return i;
+return -1;
+}
  


What happens if two pci interrupts are routed to one irq line?


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] qemu: piix: Introduce functions to get pin number from irq and vice versa

2008-10-24 Thread Amit Shah
Signed-off-by: Amit Shah <[EMAIL PROTECTED]>
---
 qemu/hw/pc.h   |3 +++
 qemu/hw/piix_pci.c |   19 +++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/pc.h b/qemu/hw/pc.h
index 1f63678..3edf62f 100644
--- a/qemu/hw/pc.h
+++ b/qemu/hw/pc.h
@@ -112,6 +112,9 @@ void i440fx_init_memory_mappings(PCIDevice *d);
 
 int piix4_init(PCIBus *bus, int devfn);
 
+int piix3_get_pin(int pic_irq);
+int piix_get_irq(int pin);
+
 /* vga.c */
 enum vga_retrace_method {
 VGA_RETRACE_DUMB,
diff --git a/qemu/hw/piix_pci.c b/qemu/hw/piix_pci.c
index 6fbf47b..dc12c8a 100644
--- a/qemu/hw/piix_pci.c
+++ b/qemu/hw/piix_pci.c
@@ -243,6 +243,25 @@ static void piix3_set_irq(qemu_irq *pic, int irq_num, int 
level)
 }
 }
 
+int piix3_get_pin(int pic_irq)
+{
+int i;
+for (i = 0; i < 4; i++)
+if (piix3_dev->config[0x60+i] == pic_irq)
+return i;
+return -1;
+}
+
+int piix_get_irq(int pin)
+{
+if (piix3_dev)
+return piix3_dev->config[0x60+pin];
+if (piix4_dev)
+return piix4_dev->config[0x60+pin];
+
+return 0;
+}
+
 static void piix3_reset(PCIDevice *d)
 {
 uint8_t *pci_conf = d->config;
-- 
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html