git: 88c217560ee4 - stable/13 - vmm: Remove vcpuid from I/O port handlers.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Jan 2023 22:11:57 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=88c217560ee451bdc0b9ade02167cfa50a53012c
commit 88c217560ee451bdc0b9ade02167cfa50a53012c
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-18 18:03:14 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 22:01:56 +0000
vmm: Remove vcpuid from I/O port handlers.
No I/O ports are vCPU-specific (unlike memory which does have
vCPU-specific ranges such as the local APIC).
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37163
(cherry picked from commit 9388bc1e3a58ac17c06e690fb9f46c9f36098f2d)
---
sys/amd64/vmm/io/vatpic.c | 6 +++---
sys/amd64/vmm/io/vatpic.h | 10 +++++-----
sys/amd64/vmm/io/vatpit.c | 5 ++---
sys/amd64/vmm/io/vatpit.h | 5 ++---
sys/amd64/vmm/io/vpmtmr.c | 3 +--
sys/amd64/vmm/io/vpmtmr.h | 3 +--
sys/amd64/vmm/io/vrtc.c | 18 ++++++++----------
sys/amd64/vmm/io/vrtc.h | 4 ++--
sys/amd64/vmm/vmm_ioport.c | 4 ++--
sys/amd64/vmm/vmm_ioport.h | 2 +-
10 files changed, 27 insertions(+), 33 deletions(-)
diff --git a/sys/amd64/vmm/io/vatpic.c b/sys/amd64/vmm/io/vatpic.c
index de34b82c0cff..1d4ccfb9d0ca 100644
--- a/sys/amd64/vmm/io/vatpic.c
+++ b/sys/amd64/vmm/io/vatpic.c
@@ -712,7 +712,7 @@ vatpic_write(struct vatpic *vatpic, struct atpic *atpic, bool in, int port,
}
int
-vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+vatpic_master_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;
@@ -732,7 +732,7 @@ vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
-vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+vatpic_slave_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;
@@ -752,7 +752,7 @@ vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
-vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+vatpic_elc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpic *vatpic;
diff --git a/sys/amd64/vmm/io/vatpic.h b/sys/amd64/vmm/io/vatpic.h
index 8990a2a5fcb0..bf46278f5b0d 100644
--- a/sys/amd64/vmm/io/vatpic.h
+++ b/sys/amd64/vmm/io/vatpic.h
@@ -41,11 +41,11 @@ struct vm_snapshot_meta;
struct vatpic *vatpic_init(struct vm *vm);
void vatpic_cleanup(struct vatpic *vatpic);
-int vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port,
- int bytes, uint32_t *eax);
-int vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port,
- int bytes, uint32_t *eax);
-int vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+int vatpic_master_handler(struct vm *vm, bool in, int port, int bytes,
+ uint32_t *eax);
+int vatpic_slave_handler(struct vm *vm, bool in, int port, int bytes,
+ uint32_t *eax);
+int vatpic_elc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
int vatpic_assert_irq(struct vm *vm, int irq);
diff --git a/sys/amd64/vmm/io/vatpit.c b/sys/amd64/vmm/io/vatpit.c
index 27bbf227cbbb..7626b4dc4cc2 100644
--- a/sys/amd64/vmm/io/vatpit.c
+++ b/sys/amd64/vmm/io/vatpit.c
@@ -336,8 +336,7 @@ vatpit_update_mode(struct vatpit *vatpit, uint8_t val)
}
int
-vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
- uint32_t *eax)
+vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax)
{
struct vatpit *vatpit;
struct channel *c;
@@ -419,7 +418,7 @@ vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
-vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+vatpit_nmisc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax)
{
struct vatpit *vatpit;
diff --git a/sys/amd64/vmm/io/vatpit.h b/sys/amd64/vmm/io/vatpit.h
index 65e06ec9bf58..96ed9c231420 100644
--- a/sys/amd64/vmm/io/vatpit.h
+++ b/sys/amd64/vmm/io/vatpit.h
@@ -41,10 +41,9 @@ struct vm_snapshot_meta;
struct vatpit *vatpit_init(struct vm *vm);
void vatpit_cleanup(struct vatpit *vatpit);
-int vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+int vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax);
+int vatpit_nmisc_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *eax);
-int vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port,
- int bytes, uint32_t *eax);
#ifdef BHYVE_SNAPSHOT
int vatpit_snapshot(struct vatpit *vatpit, struct vm_snapshot_meta *meta);
#endif
diff --git a/sys/amd64/vmm/io/vpmtmr.c b/sys/amd64/vmm/io/vpmtmr.c
index f79e94f6d0fe..825d0151c333 100644
--- a/sys/amd64/vmm/io/vpmtmr.c
+++ b/sys/amd64/vmm/io/vpmtmr.c
@@ -83,8 +83,7 @@ vpmtmr_cleanup(struct vpmtmr *vpmtmr)
}
int
-vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
- uint32_t *val)
+vpmtmr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vpmtmr *vpmtmr;
sbintime_t now, delta;
diff --git a/sys/amd64/vmm/io/vpmtmr.h b/sys/amd64/vmm/io/vpmtmr.h
index a10c0b4e8309..4ad5efcf2034 100644
--- a/sys/amd64/vmm/io/vpmtmr.h
+++ b/sys/amd64/vmm/io/vpmtmr.h
@@ -39,8 +39,7 @@ struct vm_snapshot_meta;
struct vpmtmr *vpmtmr_init(struct vm *vm);
void vpmtmr_cleanup(struct vpmtmr *pmtmr);
-int vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
- uint32_t *val);
+int vpmtmr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val);
#ifdef BHYVE_SNAPSHOT
int vpmtmr_snapshot(struct vpmtmr *vpmtmr, struct vm_snapshot_meta *meta);
diff --git a/sys/amd64/vmm/io/vrtc.c b/sys/amd64/vmm/io/vrtc.c
index 65b2cd2cb39f..d950bd68ad04 100644
--- a/sys/amd64/vmm/io/vrtc.c
+++ b/sys/amd64/vmm/io/vrtc.c
@@ -844,8 +844,7 @@ vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval)
}
int
-vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
- uint32_t *val)
+vrtc_addr_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vrtc *vrtc;
@@ -867,8 +866,7 @@ vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
}
int
-vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
- uint32_t *val)
+vrtc_data_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *val)
{
struct vrtc *vrtc;
struct rtcdev *rtc;
@@ -915,24 +913,24 @@ vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
} else {
*val = *((uint8_t *)rtc + offset);
}
- VCPU_CTR2(vm, vcpuid, "Read value %#x from RTC offset %#x",
+ VM_CTR2(vm, "Read value %#x from RTC offset %#x",
*val, offset);
} else {
switch (offset) {
case 10:
- VCPU_CTR1(vm, vcpuid, "RTC reg_a set to %#x", *val);
+ VM_CTR1(vm, "RTC reg_a set to %#x", *val);
vrtc_set_reg_a(vrtc, *val);
break;
case 11:
- VCPU_CTR1(vm, vcpuid, "RTC reg_b set to %#x", *val);
+ VM_CTR1(vm, "RTC reg_b set to %#x", *val);
error = vrtc_set_reg_b(vrtc, *val);
break;
case 12:
- VCPU_CTR1(vm, vcpuid, "RTC reg_c set to %#x (ignored)",
+ VM_CTR1(vm, "RTC reg_c set to %#x (ignored)",
*val);
break;
case 13:
- VCPU_CTR1(vm, vcpuid, "RTC reg_d set to %#x (ignored)",
+ VM_CTR1(vm, "RTC reg_d set to %#x (ignored)",
*val);
break;
case 0:
@@ -942,7 +940,7 @@ vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
*val &= 0x7f;
/* FALLTHRU */
default:
- VCPU_CTR2(vm, vcpuid, "RTC offset %#x set to %#x",
+ VM_CTR2(vm, "RTC offset %#x set to %#x",
offset, *val);
*((uint8_t *)rtc + offset) = *val;
break;
diff --git a/sys/amd64/vmm/io/vrtc.h b/sys/amd64/vmm/io/vrtc.h
index 791fb7db3e26..0f11b8d5fc53 100644
--- a/sys/amd64/vmm/io/vrtc.h
+++ b/sys/amd64/vmm/io/vrtc.h
@@ -45,9 +45,9 @@ int vrtc_set_time(struct vm *vm, time_t secs);
int vrtc_nvram_write(struct vm *vm, int offset, uint8_t value);
int vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval);
-int vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+int vrtc_addr_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *val);
-int vrtc_data_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,
+int vrtc_data_handler(struct vm *vm, bool in, int port, int bytes,
uint32_t *val);
#ifdef BHYVE_SNAPSHOT
diff --git a/sys/amd64/vmm/vmm_ioport.c b/sys/amd64/vmm/vmm_ioport.c
index 601a2e18f745..50c02378a4c5 100644
--- a/sys/amd64/vmm/vmm_ioport.c
+++ b/sys/amd64/vmm/vmm_ioport.c
@@ -122,8 +122,8 @@ emulate_inout_port(struct vm *vm, int vcpuid, struct vm_exit *vmexit,
val = vmexit->u.inout.eax & mask;
}
- error = (*handler)(vm, vcpuid, vmexit->u.inout.in,
- vmexit->u.inout.port, vmexit->u.inout.bytes, &val);
+ error = (*handler)(vm, vmexit->u.inout.in, vmexit->u.inout.port,
+ vmexit->u.inout.bytes, &val);
if (error) {
/*
* The value returned by this function is also the return value
diff --git a/sys/amd64/vmm/vmm_ioport.h b/sys/amd64/vmm/vmm_ioport.h
index 14e315f400ce..fd20ecfd5e94 100644
--- a/sys/amd64/vmm/vmm_ioport.h
+++ b/sys/amd64/vmm/vmm_ioport.h
@@ -31,7 +31,7 @@
#ifndef _VMM_IOPORT_H_
#define _VMM_IOPORT_H_
-typedef int (*ioport_handler_func_t)(struct vm *vm, int vcpuid,
+typedef int (*ioport_handler_func_t)(struct vm *vm,
bool in, int port, int bytes, uint32_t *val);
int vm_handle_inout(struct vm *vm, int vcpuid, struct vm_exit *vme, bool *retu);