pci-assign: Remove dead code for direct I/O region access from userspace
This feature was already deprecated back then in qemu-kvm, ie. before pci-assign went upstream. assigned_dev_ioport_rw will never be invoked with resource_fd < 0. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
This commit is contained in:
parent
0fd53fec92
commit
3a902babf1
|
@ -154,55 +154,19 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
|
||||||
uint64_t val = 0;
|
uint64_t val = 0;
|
||||||
int fd = dev_region->region->resource_fd;
|
int fd = dev_region->region->resource_fd;
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (data) {
|
||||||
if (data) {
|
DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
||||||
DEBUG("pwrite data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
|
||||||
", addr="TARGET_FMT_plx"\n", *data, size, addr, addr);
|
if (pwrite(fd, data, size, addr) != size) {
|
||||||
if (pwrite(fd, data, size, addr) != size) {
|
error_report("%s - pwrite failed %s", __func__, strerror(errno));
|
||||||
error_report("%s - pwrite failed %s",
|
|
||||||
__func__, strerror(errno));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (pread(fd, &val, size, addr) != size) {
|
|
||||||
error_report("%s - pread failed %s",
|
|
||||||
__func__, strerror(errno));
|
|
||||||
val = (1UL << (size * 8)) - 1;
|
|
||||||
}
|
|
||||||
DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
|
||||||
", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uint32_t port = addr + dev_region->u.r_baseport;
|
if (pread(fd, &val, size, addr) != size) {
|
||||||
|
error_report("%s - pread failed %s", __func__, strerror(errno));
|
||||||
if (data) {
|
val = (1UL << (size * 8)) - 1;
|
||||||
DEBUG("out data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
|
||||||
", host=%x\n", *data, size, addr, port);
|
|
||||||
switch (size) {
|
|
||||||
case 1:
|
|
||||||
outb(*data, port);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
outw(*data, port);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
outl(*data, port);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (size) {
|
|
||||||
case 1:
|
|
||||||
val = inb(port);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
val = inw(port);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
val = inl(port);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DEBUG("in data=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
|
||||||
", host=%x\n", val, size, addr, port);
|
|
||||||
}
|
}
|
||||||
|
DEBUG("pread val=%" PRIx64 ", size=%d, e_phys=" TARGET_FMT_plx
|
||||||
|
", addr=" TARGET_FMT_plx "\n", val, size, addr, addr);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue