* [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
@ 2012-05-29 17:04 Jan Kiszka
2012-05-29 17:11 ` Alex Williamson
2012-05-29 17:13 ` Avi Kivity
0 siblings, 2 replies; 8+ messages in thread
From: Jan Kiszka @ 2012-05-29 17:04 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Alex Williamson
As suggested by Alex: Instead of failing if the kernel does not allow us
to speak to an ioport region, warn the user but, hide the region and
continue.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/device-assignment.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 9ad5de5..e47a23c 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -429,11 +429,12 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
fprintf(stderr, "Unexpected return from I/O port read: %d\n",
ret);
abort();
- } else if (errno != EINVAL) {
- fprintf(stderr,
- "Kernel doesn't support ioport resource access.\n");
+ } else if (errno != EINVAL || 1) {
+ fprintf(stderr, "Kernel doesn't support ioport resource "
+ "access, hiding this region.\n");
close(pci_dev->v_addrs[i].region->resource_fd);
- return -1;
+ cur_region->valid = 0;
+ continue;
}
pci_dev->v_addrs[i].u.r_baseport = cur_region->base_addr;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-29 17:04 [PATCH] pci-assign: Hide ioport regions on lacking sysfs support Jan Kiszka
@ 2012-05-29 17:11 ` Alex Williamson
2012-05-29 17:13 ` Avi Kivity
1 sibling, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2012-05-29 17:11 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm
On Tue, 2012-05-29 at 19:04 +0200, Jan Kiszka wrote:
> As suggested by Alex: Instead of failing if the kernel does not allow us
> to speak to an ioport region, warn the user but, hide the region and
> continue.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> hw/device-assignment.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
Thanks!
Acked-by: Alex Williamson <alex.williamson@redhat.com>
> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
> index 9ad5de5..e47a23c 100644
> --- a/hw/device-assignment.c
> +++ b/hw/device-assignment.c
> @@ -429,11 +429,12 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
> fprintf(stderr, "Unexpected return from I/O port read: %d\n",
> ret);
> abort();
> - } else if (errno != EINVAL) {
> - fprintf(stderr,
> - "Kernel doesn't support ioport resource access.\n");
> + } else if (errno != EINVAL || 1) {
> + fprintf(stderr, "Kernel doesn't support ioport resource "
> + "access, hiding this region.\n");
> close(pci_dev->v_addrs[i].region->resource_fd);
> - return -1;
> + cur_region->valid = 0;
> + continue;
> }
>
> pci_dev->v_addrs[i].u.r_baseport = cur_region->base_addr;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-29 17:04 [PATCH] pci-assign: Hide ioport regions on lacking sysfs support Jan Kiszka
2012-05-29 17:11 ` Alex Williamson
@ 2012-05-29 17:13 ` Avi Kivity
2012-05-29 17:28 ` Alex Williamson
1 sibling, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2012-05-29 17:13 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Marcelo Tosatti, kvm, Alex Williamson
On 05/29/2012 08:04 PM, Jan Kiszka wrote:
> As suggested by Alex: Instead of failing if the kernel does not allow us
> to speak to an ioport region, warn the user but, hide the region and
> continue.
Should we not, in addition, abort if the region is actually used? A
guest malfunction is likely if we don't.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-29 17:13 ` Avi Kivity
@ 2012-05-29 17:28 ` Alex Williamson
2012-05-30 8:21 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: Alex Williamson @ 2012-05-29 17:28 UTC (permalink / raw)
To: Avi Kivity; +Cc: Jan Kiszka, Marcelo Tosatti, kvm
On Tue, 2012-05-29 at 20:13 +0300, Avi Kivity wrote:
> On 05/29/2012 08:04 PM, Jan Kiszka wrote:
> > As suggested by Alex: Instead of failing if the kernel does not allow us
> > to speak to an ioport region, warn the user but, hide the region and
> > continue.
>
>
> Should we not, in addition, abort if the region is actually used? A
> guest malfunction is likely if we don't.
The only way we could know that it's used is if it's the device ends up
with no valid regions as a result of this. Otherwise it's dependent on
both the device and the driver whether it can still function without the
i/o port regions. Thanks,
Alex
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-29 17:28 ` Alex Williamson
@ 2012-05-30 8:21 ` Avi Kivity
2012-05-30 8:47 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2012-05-30 8:21 UTC (permalink / raw)
To: Alex Williamson; +Cc: Jan Kiszka, Marcelo Tosatti, kvm
On 05/29/2012 08:28 PM, Alex Williamson wrote:
> On Tue, 2012-05-29 at 20:13 +0300, Avi Kivity wrote:
>> On 05/29/2012 08:04 PM, Jan Kiszka wrote:
>> > As suggested by Alex: Instead of failing if the kernel does not allow us
>> > to speak to an ioport region, warn the user but, hide the region and
>> > continue.
>>
>>
>> Should we not, in addition, abort if the region is actually used? A
>> guest malfunction is likely if we don't.
>
> The only way we could know that it's used is if it's the device ends up
> with no valid regions as a result of this. Otherwise it's dependent on
> both the device and the driver whether it can still function without the
> i/o port regions. Thanks,
If the I/O callback is called, we know it's used.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-30 8:21 ` Avi Kivity
@ 2012-05-30 8:47 ` Jan Kiszka
2012-05-30 8:50 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2012-05-30 8:47 UTC (permalink / raw)
To: Avi Kivity; +Cc: Alex Williamson, Marcelo Tosatti, kvm
On 2012-05-30 10:21, Avi Kivity wrote:
> On 05/29/2012 08:28 PM, Alex Williamson wrote:
>> On Tue, 2012-05-29 at 20:13 +0300, Avi Kivity wrote:
>>> On 05/29/2012 08:04 PM, Jan Kiszka wrote:
>>>> As suggested by Alex: Instead of failing if the kernel does not allow us
>>>> to speak to an ioport region, warn the user but, hide the region and
>>>> continue.
>>>
>>>
>>> Should we not, in addition, abort if the region is actually used? A
>>> guest malfunction is likely if we don't.
>>
>> The only way we could know that it's used is if it's the device ends up
>> with no valid regions as a result of this. Otherwise it's dependent on
>> both the device and the driver whether it can still function without the
>> i/o port regions. Thanks,
>
> If the I/O callback is called, we know it's used.
We neither expose the region to the guest (so the guest has no clue
where to write to unless it assumes a fixed address - of which we have
no clue) nor register any callback for it.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-30 8:47 ` Jan Kiszka
@ 2012-05-30 8:50 ` Avi Kivity
2012-05-30 9:01 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2012-05-30 8:50 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Alex Williamson, Marcelo Tosatti, kvm
On 05/30/2012 11:47 AM, Jan Kiszka wrote:
> On 2012-05-30 10:21, Avi Kivity wrote:
>> On 05/29/2012 08:28 PM, Alex Williamson wrote:
>>> On Tue, 2012-05-29 at 20:13 +0300, Avi Kivity wrote:
>>>> On 05/29/2012 08:04 PM, Jan Kiszka wrote:
>>>>> As suggested by Alex: Instead of failing if the kernel does not allow us
>>>>> to speak to an ioport region, warn the user but, hide the region and
>>>>> continue.
>>>>
>>>>
>>>> Should we not, in addition, abort if the region is actually used? A
>>>> guest malfunction is likely if we don't.
>>>
>>> The only way we could know that it's used is if it's the device ends up
>>> with no valid regions as a result of this. Otherwise it's dependent on
>>> both the device and the driver whether it can still function without the
>>> i/o port regions. Thanks,
>>
>> If the I/O callback is called, we know it's used.
>
> We neither expose the region to the guest (so the guest has no clue
> where to write to unless it assumes a fixed address - of which we have
> no clue) nor register any callback for it.
Ah, I thought you expose the BAR but don't back it with anything. No
idea which approach is better, so we might as well try yours first.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pci-assign: Hide ioport regions on lacking sysfs support
2012-05-30 8:50 ` Avi Kivity
@ 2012-05-30 9:01 ` Jan Kiszka
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2012-05-30 9:01 UTC (permalink / raw)
To: Avi Kivity; +Cc: Alex Williamson, Marcelo Tosatti, kvm
On 2012-05-30 10:50, Avi Kivity wrote:
> On 05/30/2012 11:47 AM, Jan Kiszka wrote:
>> On 2012-05-30 10:21, Avi Kivity wrote:
>>> On 05/29/2012 08:28 PM, Alex Williamson wrote:
>>>> On Tue, 2012-05-29 at 20:13 +0300, Avi Kivity wrote:
>>>>> On 05/29/2012 08:04 PM, Jan Kiszka wrote:
>>>>>> As suggested by Alex: Instead of failing if the kernel does not allow us
>>>>>> to speak to an ioport region, warn the user but, hide the region and
>>>>>> continue.
>>>>>
>>>>>
>>>>> Should we not, in addition, abort if the region is actually used? A
>>>>> guest malfunction is likely if we don't.
>>>>
>>>> The only way we could know that it's used is if it's the device ends up
>>>> with no valid regions as a result of this. Otherwise it's dependent on
>>>> both the device and the driver whether it can still function without the
>>>> i/o port regions. Thanks,
>>>
>>> If the I/O callback is called, we know it's used.
>>
>> We neither expose the region to the guest (so the guest has no clue
>> where to write to unless it assumes a fixed address - of which we have
>> no clue) nor register any callback for it.
>
> Ah, I thought you expose the BAR but don't back it with anything. No
> idea which approach is better, so we might as well try yours first.
Great. But don't apply this version, I just found some testing
left-over. Will send and update soon.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-05-30 9:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-29 17:04 [PATCH] pci-assign: Hide ioport regions on lacking sysfs support Jan Kiszka
2012-05-29 17:11 ` Alex Williamson
2012-05-29 17:13 ` Avi Kivity
2012-05-29 17:28 ` Alex Williamson
2012-05-30 8:21 ` Avi Kivity
2012-05-30 8:47 ` Jan Kiszka
2012-05-30 8:50 ` Avi Kivity
2012-05-30 9:01 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox