mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20180216' into staging
ppc patch queue 2018-02-16
Highlights of this batch:
* Conversion to TranslatorOps (Emilio Cota)
* Further bugfixes and cleanups to vcpu id allocation for pseries
(Greg Kurz)
* Another bugfix for HPT resizing (Daniel Henrique-Barboza)
* Macintosh CUDA cleanups (Mark Cave-Ayland)
* Further tweaks to Spectre/Meltdown mitigations (Suraj Singh)
# gpg: Signature made Fri 16 Feb 2018 10:00:02 GMT
# gpg: using RSA key 6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg: aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392
* remotes/dgibson/tags/ppc-for-2.12-20180216:
ppc4xx: Add device models found in PPC440 core SoCs
ppc/spapr-caps: Disallow setting workaround for spapr-cap-ibs
target/ppc: convert to TranslatorOps
target/ppc: convert to DisasContextBase
spapr: consolidate the VCPU id numbering logic in a single place
spapr: rename spapr_vcpu_id() to spapr_get_vcpu_id()
spapr: move VCPU calculation to core machine code
spapr: use spapr->vsmt to compute VCPU ids
ppc/spapr-caps: Change migration macro to take full spapr-cap name
hw/char: remove legacy interface escc_init()
hw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit
cuda: convert to trace-events
ppc: move CUDAState and other CUDA-related definitions into separate cuda.h file
cuda: convert to use the shared mos6522 device
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -133,6 +133,7 @@ trace-events-subdirs += hw/net
|
||||
trace-events-subdirs += hw/virtio
|
||||
trace-events-subdirs += hw/audio
|
||||
trace-events-subdirs += hw/misc
|
||||
trace-events-subdirs += hw/misc/macio
|
||||
trace-events-subdirs += hw/usb
|
||||
trace-events-subdirs += hw/scsi
|
||||
trace-events-subdirs += hw/nvram
|
||||
|
||||
+57
-152
@@ -26,10 +26,7 @@
|
||||
#include "hw/hw.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/char/escc.h"
|
||||
#include "chardev/char-fe.h"
|
||||
#include "chardev/char-serial.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/input.h"
|
||||
#include "trace.h"
|
||||
|
||||
/*
|
||||
@@ -64,53 +61,7 @@
|
||||
* 2010-May-23 Artyom Tarasenko: Reworked IUS logic
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
chn_a, chn_b,
|
||||
} ChnID;
|
||||
|
||||
#define CHN_C(s) ((s)->chn == chn_b? 'b' : 'a')
|
||||
|
||||
typedef enum {
|
||||
ser, kbd, mouse,
|
||||
} ChnType;
|
||||
|
||||
#define SERIO_QUEUE_SIZE 256
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[SERIO_QUEUE_SIZE];
|
||||
int rptr, wptr, count;
|
||||
} SERIOQueue;
|
||||
|
||||
#define SERIAL_REGS 16
|
||||
typedef struct ChannelState {
|
||||
qemu_irq irq;
|
||||
uint32_t rxint, txint, rxint_under_svc, txint_under_svc;
|
||||
struct ChannelState *otherchn;
|
||||
uint32_t reg;
|
||||
uint8_t wregs[SERIAL_REGS], rregs[SERIAL_REGS];
|
||||
SERIOQueue queue;
|
||||
CharBackend chr;
|
||||
int e0_mode, led_mode, caps_lock_mode, num_lock_mode;
|
||||
int disabled;
|
||||
int clock;
|
||||
uint32_t vmstate_dummy;
|
||||
ChnID chn; // this channel, A (base+4) or B (base+0)
|
||||
ChnType type;
|
||||
uint8_t rx, tx;
|
||||
QemuInputHandlerState *hs;
|
||||
} ChannelState;
|
||||
|
||||
#define ESCC(obj) OBJECT_CHECK(ESCCState, (obj), TYPE_ESCC)
|
||||
|
||||
typedef struct ESCCState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
struct ChannelState chn[2];
|
||||
uint32_t it_shift;
|
||||
MemoryRegion mmio;
|
||||
uint32_t disabled;
|
||||
uint32_t frequency;
|
||||
} ESCCState;
|
||||
#define CHN_C(s) ((s)->chn == escc_chn_b ? 'b' : 'a')
|
||||
|
||||
#define SERIAL_CTRL 0
|
||||
#define SERIAL_DATA 1
|
||||
@@ -214,44 +165,47 @@ typedef struct ESCCState {
|
||||
#define R_MISC1I 14
|
||||
#define R_EXTINT 15
|
||||
|
||||
static void handle_kbd_command(ChannelState *s, int val);
|
||||
static void handle_kbd_command(ESCCChannelState *s, int val);
|
||||
static int serial_can_receive(void *opaque);
|
||||
static void serial_receive_byte(ChannelState *s, int ch);
|
||||
static void serial_receive_byte(ESCCChannelState *s, int ch);
|
||||
|
||||
static void clear_queue(void *opaque)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
SERIOQueue *q = &s->queue;
|
||||
ESCCChannelState *s = opaque;
|
||||
ESCCSERIOQueue *q = &s->queue;
|
||||
q->rptr = q->wptr = q->count = 0;
|
||||
}
|
||||
|
||||
static void put_queue(void *opaque, int b)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
SERIOQueue *q = &s->queue;
|
||||
ESCCChannelState *s = opaque;
|
||||
ESCCSERIOQueue *q = &s->queue;
|
||||
|
||||
trace_escc_put_queue(CHN_C(s), b);
|
||||
if (q->count >= SERIO_QUEUE_SIZE)
|
||||
if (q->count >= ESCC_SERIO_QUEUE_SIZE) {
|
||||
return;
|
||||
}
|
||||
q->data[q->wptr] = b;
|
||||
if (++q->wptr == SERIO_QUEUE_SIZE)
|
||||
if (++q->wptr == ESCC_SERIO_QUEUE_SIZE) {
|
||||
q->wptr = 0;
|
||||
}
|
||||
q->count++;
|
||||
serial_receive_byte(s, 0);
|
||||
}
|
||||
|
||||
static uint32_t get_queue(void *opaque)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
SERIOQueue *q = &s->queue;
|
||||
ESCCChannelState *s = opaque;
|
||||
ESCCSERIOQueue *q = &s->queue;
|
||||
int val;
|
||||
|
||||
if (q->count == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
val = q->data[q->rptr];
|
||||
if (++q->rptr == SERIO_QUEUE_SIZE)
|
||||
if (++q->rptr == ESCC_SERIO_QUEUE_SIZE) {
|
||||
q->rptr = 0;
|
||||
}
|
||||
q->count--;
|
||||
}
|
||||
trace_escc_get_queue(CHN_C(s), val);
|
||||
@@ -260,7 +214,7 @@ static uint32_t get_queue(void *opaque)
|
||||
return val;
|
||||
}
|
||||
|
||||
static int escc_update_irq_chn(ChannelState *s)
|
||||
static int escc_update_irq_chn(ESCCChannelState *s)
|
||||
{
|
||||
if ((((s->wregs[W_INTR] & INTR_TXINT) && (s->txint == 1)) ||
|
||||
// tx ints enabled, pending
|
||||
@@ -274,7 +228,7 @@ static int escc_update_irq_chn(ChannelState *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void escc_update_irq(ChannelState *s)
|
||||
static void escc_update_irq(ESCCChannelState *s)
|
||||
{
|
||||
int irq;
|
||||
|
||||
@@ -285,12 +239,12 @@ static void escc_update_irq(ChannelState *s)
|
||||
qemu_set_irq(s->irq, irq);
|
||||
}
|
||||
|
||||
static void escc_reset_chn(ChannelState *s)
|
||||
static void escc_reset_chn(ESCCChannelState *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
s->reg = 0;
|
||||
for (i = 0; i < SERIAL_REGS; i++) {
|
||||
for (i = 0; i < ESCC_SERIAL_REGS; i++) {
|
||||
s->rregs[i] = 0;
|
||||
s->wregs[i] = 0;
|
||||
}
|
||||
@@ -322,13 +276,13 @@ static void escc_reset(DeviceState *d)
|
||||
escc_reset_chn(&s->chn[1]);
|
||||
}
|
||||
|
||||
static inline void set_rxint(ChannelState *s)
|
||||
static inline void set_rxint(ESCCChannelState *s)
|
||||
{
|
||||
s->rxint = 1;
|
||||
/* XXX: missing daisy chainnig: chn_b rx should have a lower priority
|
||||
/* XXX: missing daisy chainnig: escc_chn_b rx should have a lower priority
|
||||
than chn_a rx/tx/special_condition service*/
|
||||
s->rxint_under_svc = 1;
|
||||
if (s->chn == chn_a) {
|
||||
if (s->chn == escc_chn_a) {
|
||||
s->rregs[R_INTR] |= INTR_RXINTA;
|
||||
if (s->wregs[W_MINTR] & MINTR_STATUSHI)
|
||||
s->otherchn->rregs[R_IVEC] = IVEC_HIRXINTA;
|
||||
@@ -344,12 +298,12 @@ static inline void set_rxint(ChannelState *s)
|
||||
escc_update_irq(s);
|
||||
}
|
||||
|
||||
static inline void set_txint(ChannelState *s)
|
||||
static inline void set_txint(ESCCChannelState *s)
|
||||
{
|
||||
s->txint = 1;
|
||||
if (!s->rxint_under_svc) {
|
||||
s->txint_under_svc = 1;
|
||||
if (s->chn == chn_a) {
|
||||
if (s->chn == escc_chn_a) {
|
||||
if (s->wregs[W_INTR] & INTR_TXINT) {
|
||||
s->rregs[R_INTR] |= INTR_TXINTA;
|
||||
}
|
||||
@@ -367,11 +321,11 @@ static inline void set_txint(ChannelState *s)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void clr_rxint(ChannelState *s)
|
||||
static inline void clr_rxint(ESCCChannelState *s)
|
||||
{
|
||||
s->rxint = 0;
|
||||
s->rxint_under_svc = 0;
|
||||
if (s->chn == chn_a) {
|
||||
if (s->chn == escc_chn_a) {
|
||||
if (s->wregs[W_MINTR] & MINTR_STATUSHI)
|
||||
s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
|
||||
else
|
||||
@@ -389,11 +343,11 @@ static inline void clr_rxint(ChannelState *s)
|
||||
escc_update_irq(s);
|
||||
}
|
||||
|
||||
static inline void clr_txint(ChannelState *s)
|
||||
static inline void clr_txint(ESCCChannelState *s)
|
||||
{
|
||||
s->txint = 0;
|
||||
s->txint_under_svc = 0;
|
||||
if (s->chn == chn_a) {
|
||||
if (s->chn == escc_chn_a) {
|
||||
if (s->wregs[W_MINTR] & MINTR_STATUSHI)
|
||||
s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
|
||||
else
|
||||
@@ -412,12 +366,12 @@ static inline void clr_txint(ChannelState *s)
|
||||
escc_update_irq(s);
|
||||
}
|
||||
|
||||
static void escc_update_parameters(ChannelState *s)
|
||||
static void escc_update_parameters(ESCCChannelState *s)
|
||||
{
|
||||
int speed, parity, data_bits, stop_bits;
|
||||
QEMUSerialSetParams ssp;
|
||||
|
||||
if (!qemu_chr_fe_backend_connected(&s->chr) || s->type != ser)
|
||||
if (!qemu_chr_fe_backend_connected(&s->chr) || s->type != escc_serial)
|
||||
return;
|
||||
|
||||
if (s->wregs[W_TXCTRL1] & TXCTRL1_PAREN) {
|
||||
@@ -474,7 +428,7 @@ static void escc_mem_write(void *opaque, hwaddr addr,
|
||||
uint64_t val, unsigned size)
|
||||
{
|
||||
ESCCState *serial = opaque;
|
||||
ChannelState *s;
|
||||
ESCCChannelState *s;
|
||||
uint32_t saddr;
|
||||
int newreg, channel;
|
||||
|
||||
@@ -561,7 +515,7 @@ static void escc_mem_write(void *opaque, hwaddr addr,
|
||||
/* XXX this blocks entire thread. Rewrite to use
|
||||
* qemu_chr_fe_write and background I/O callbacks */
|
||||
qemu_chr_fe_write_all(&s->chr, &s->tx, 1);
|
||||
} else if (s->type == kbd && !s->disabled) {
|
||||
} else if (s->type == escc_kbd && !s->disabled) {
|
||||
handle_kbd_command(s, val);
|
||||
}
|
||||
}
|
||||
@@ -578,7 +532,7 @@ static uint64_t escc_mem_read(void *opaque, hwaddr addr,
|
||||
unsigned size)
|
||||
{
|
||||
ESCCState *serial = opaque;
|
||||
ChannelState *s;
|
||||
ESCCChannelState *s;
|
||||
uint32_t saddr;
|
||||
uint32_t ret;
|
||||
int channel;
|
||||
@@ -595,10 +549,11 @@ static uint64_t escc_mem_read(void *opaque, hwaddr addr,
|
||||
case SERIAL_DATA:
|
||||
s->rregs[R_STATUS] &= ~STATUS_RXAV;
|
||||
clr_rxint(s);
|
||||
if (s->type == kbd || s->type == mouse)
|
||||
if (s->type == escc_kbd || s->type == escc_mouse) {
|
||||
ret = get_queue(s);
|
||||
else
|
||||
} else {
|
||||
ret = s->rx;
|
||||
}
|
||||
trace_escc_mem_readb_data(CHN_C(s), ret);
|
||||
qemu_chr_fe_accept_input(&s->chr);
|
||||
return ret;
|
||||
@@ -620,7 +575,7 @@ static const MemoryRegionOps escc_mem_ops = {
|
||||
|
||||
static int serial_can_receive(void *opaque)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
ESCCChannelState *s = opaque;
|
||||
int ret;
|
||||
|
||||
if (((s->wregs[W_RXCTRL] & RXCTRL_RXEN) == 0) // Rx not enabled
|
||||
@@ -632,7 +587,7 @@ static int serial_can_receive(void *opaque)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void serial_receive_byte(ChannelState *s, int ch)
|
||||
static void serial_receive_byte(ESCCChannelState *s, int ch)
|
||||
{
|
||||
trace_escc_serial_receive_byte(CHN_C(s), ch);
|
||||
s->rregs[R_STATUS] |= STATUS_RXAV;
|
||||
@@ -640,7 +595,7 @@ static void serial_receive_byte(ChannelState *s, int ch)
|
||||
set_rxint(s);
|
||||
}
|
||||
|
||||
static void serial_receive_break(ChannelState *s)
|
||||
static void serial_receive_break(ESCCChannelState *s)
|
||||
{
|
||||
s->rregs[R_STATUS] |= STATUS_BRK;
|
||||
escc_update_irq(s);
|
||||
@@ -648,13 +603,13 @@ static void serial_receive_break(ChannelState *s)
|
||||
|
||||
static void serial_receive1(void *opaque, const uint8_t *buf, int size)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
ESCCChannelState *s = opaque;
|
||||
serial_receive_byte(s, buf[0]);
|
||||
}
|
||||
|
||||
static void serial_event(void *opaque, int event)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
ESCCChannelState *s = opaque;
|
||||
if (event == CHR_EVENT_BREAK)
|
||||
serial_receive_break(s);
|
||||
}
|
||||
@@ -664,16 +619,16 @@ static const VMStateDescription vmstate_escc_chn = {
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(vmstate_dummy, ChannelState),
|
||||
VMSTATE_UINT32(reg, ChannelState),
|
||||
VMSTATE_UINT32(rxint, ChannelState),
|
||||
VMSTATE_UINT32(txint, ChannelState),
|
||||
VMSTATE_UINT32(rxint_under_svc, ChannelState),
|
||||
VMSTATE_UINT32(txint_under_svc, ChannelState),
|
||||
VMSTATE_UINT8(rx, ChannelState),
|
||||
VMSTATE_UINT8(tx, ChannelState),
|
||||
VMSTATE_BUFFER(wregs, ChannelState),
|
||||
VMSTATE_BUFFER(rregs, ChannelState),
|
||||
VMSTATE_UINT32(vmstate_dummy, ESCCChannelState),
|
||||
VMSTATE_UINT32(reg, ESCCChannelState),
|
||||
VMSTATE_UINT32(rxint, ESCCChannelState),
|
||||
VMSTATE_UINT32(txint, ESCCChannelState),
|
||||
VMSTATE_UINT32(rxint_under_svc, ESCCChannelState),
|
||||
VMSTATE_UINT32(txint_under_svc, ESCCChannelState),
|
||||
VMSTATE_UINT8(rx, ESCCChannelState),
|
||||
VMSTATE_UINT8(tx, ESCCChannelState),
|
||||
VMSTATE_BUFFER(wregs, ESCCChannelState),
|
||||
VMSTATE_BUFFER(rregs, ESCCChannelState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -684,44 +639,15 @@ static const VMStateDescription vmstate_escc = {
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_STRUCT_ARRAY(chn, ESCCState, 2, 2, vmstate_escc_chn,
|
||||
ChannelState),
|
||||
ESCCChannelState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
MemoryRegion *escc_init(hwaddr base, qemu_irq irqA, qemu_irq irqB,
|
||||
Chardev *chrA, Chardev *chrB,
|
||||
int clock, int it_shift)
|
||||
{
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
ESCCState *d;
|
||||
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", 0);
|
||||
qdev_prop_set_uint32(dev, "frequency", clock);
|
||||
qdev_prop_set_uint32(dev, "it_shift", it_shift);
|
||||
qdev_prop_set_chr(dev, "chrB", chrB);
|
||||
qdev_prop_set_chr(dev, "chrA", chrA);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", ser);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", ser);
|
||||
qdev_init_nofail(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, irqB);
|
||||
sysbus_connect_irq(s, 1, irqA);
|
||||
if (base) {
|
||||
sysbus_mmio_map(s, 0, base);
|
||||
}
|
||||
|
||||
d = ESCC(s);
|
||||
return &d->mmio;
|
||||
}
|
||||
|
||||
|
||||
static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
InputEvent *evt)
|
||||
{
|
||||
ChannelState *s = (ChannelState *)dev;
|
||||
ESCCChannelState *s = (ESCCChannelState *)dev;
|
||||
int qcode, keycode;
|
||||
InputKeyEvent *key;
|
||||
|
||||
@@ -777,7 +703,7 @@ static QemuInputHandler sunkbd_handler = {
|
||||
.event = sunkbd_handle_event,
|
||||
};
|
||||
|
||||
static void handle_kbd_command(ChannelState *s, int val)
|
||||
static void handle_kbd_command(ESCCChannelState *s, int val)
|
||||
{
|
||||
trace_escc_kbd_command(val);
|
||||
if (s->led_mode) { // Ignore led byte
|
||||
@@ -808,7 +734,7 @@ static void handle_kbd_command(ChannelState *s, int val)
|
||||
static void sunmouse_event(void *opaque,
|
||||
int dx, int dy, int dz, int buttons_state)
|
||||
{
|
||||
ChannelState *s = opaque;
|
||||
ESCCChannelState *s = opaque;
|
||||
int ch;
|
||||
|
||||
trace_escc_sunmouse_event(dx, dy, buttons_state);
|
||||
@@ -847,27 +773,6 @@ static void sunmouse_event(void *opaque,
|
||||
put_queue(s, 0);
|
||||
}
|
||||
|
||||
void slavio_serial_ms_kbd_init(hwaddr base, qemu_irq irq,
|
||||
int disabled, int clock, int it_shift)
|
||||
{
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", disabled);
|
||||
qdev_prop_set_uint32(dev, "frequency", clock);
|
||||
qdev_prop_set_uint32(dev, "it_shift", it_shift);
|
||||
qdev_prop_set_chr(dev, "chrB", NULL);
|
||||
qdev_prop_set_chr(dev, "chrA", NULL);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", mouse);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", kbd);
|
||||
qdev_init_nofail(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, irq);
|
||||
sysbus_connect_irq(s, 1, irq);
|
||||
sysbus_mmio_map(s, 0, base);
|
||||
}
|
||||
|
||||
static void escc_init1(Object *obj)
|
||||
{
|
||||
ESCCState *s = ESCC(obj);
|
||||
@@ -904,11 +809,11 @@ static void escc_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
if (s->chn[0].type == mouse) {
|
||||
if (s->chn[0].type == escc_mouse) {
|
||||
qemu_add_mouse_event_handler(sunmouse_event, &s->chn[0], 0,
|
||||
"QEMU Sun Mouse");
|
||||
}
|
||||
if (s->chn[1].type == kbd) {
|
||||
if (s->chn[1].type == escc_kbd) {
|
||||
s->chn[1].hs = qemu_input_handler_register((DeviceState *)(&s->chn[1]),
|
||||
&sunkbd_handler);
|
||||
}
|
||||
|
||||
+173
-476
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "hw/hw.h"
|
||||
#include "hw/ppc/mac.h"
|
||||
#include "hw/misc/macio/cuda.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/ppc/mac_dbdma.h"
|
||||
#include "hw/char/escc.h"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# See docs/devel/tracing.txt for syntax documentation.
|
||||
|
||||
# hw/misc/macio/cuda.c
|
||||
cuda_delay_set_sr_int(void) ""
|
||||
cuda_data_send(uint8_t data) "send: 0x%02x"
|
||||
cuda_data_recv(uint8_t data) "recv: 0x%02x"
|
||||
cuda_receive_packet_cmd(const char *cmd) "handling command %s"
|
||||
cuda_packet_receive(int len) "length %d"
|
||||
cuda_packet_receive_data(int i, const uint8_t data) "[%d] 0x%02x"
|
||||
cuda_packet_send(int len) "length %d"
|
||||
cuda_packet_send_data(int i, const uint8_t data) "[%d] 0x%02x"
|
||||
+1
-75
@@ -30,6 +30,7 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/ide/internal.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
|
||||
/* SMP is not enabled, for now */
|
||||
#define MAX_CPUS 1
|
||||
@@ -44,81 +45,6 @@
|
||||
|
||||
#define ESCC_CLOCK 3686400
|
||||
|
||||
/* Cuda */
|
||||
#define TYPE_CUDA "cuda"
|
||||
#define CUDA(obj) OBJECT_CHECK(CUDAState, (obj), TYPE_CUDA)
|
||||
|
||||
/**
|
||||
* CUDATimer:
|
||||
* @counter_value: counter value at load time
|
||||
*/
|
||||
typedef struct CUDATimer {
|
||||
int index;
|
||||
uint16_t latch;
|
||||
uint16_t counter_value;
|
||||
int64_t load_time;
|
||||
int64_t next_irq_time;
|
||||
uint64_t frequency;
|
||||
QEMUTimer *timer;
|
||||
} CUDATimer;
|
||||
|
||||
/**
|
||||
* CUDAState:
|
||||
* @b: B-side data
|
||||
* @a: A-side data
|
||||
* @dirb: B-side direction (1=output)
|
||||
* @dira: A-side direction (1=output)
|
||||
* @sr: Shift register
|
||||
* @acr: Auxiliary control register
|
||||
* @pcr: Peripheral control register
|
||||
* @ifr: Interrupt flag register
|
||||
* @ier: Interrupt enable register
|
||||
* @anh: A-side data, no handshake
|
||||
* @last_b: last value of B register
|
||||
* @last_acr: last value of ACR register
|
||||
*/
|
||||
typedef struct CUDAState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
/*< public >*/
|
||||
|
||||
MemoryRegion mem;
|
||||
/* cuda registers */
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
uint8_t dirb;
|
||||
uint8_t dira;
|
||||
uint8_t sr;
|
||||
uint8_t acr;
|
||||
uint8_t pcr;
|
||||
uint8_t ifr;
|
||||
uint8_t ier;
|
||||
uint8_t anh;
|
||||
|
||||
ADBBusState adb_bus;
|
||||
CUDATimer timers[2];
|
||||
|
||||
uint32_t tick_offset;
|
||||
uint64_t tb_frequency;
|
||||
|
||||
uint8_t last_b;
|
||||
uint8_t last_acr;
|
||||
|
||||
/* MacOS 9 is racy and requires a delay upon setting the SR_INT bit */
|
||||
QEMUTimer *sr_delay_timer;
|
||||
|
||||
int data_in_size;
|
||||
int data_in_index;
|
||||
int data_out_index;
|
||||
|
||||
qemu_irq irq;
|
||||
uint16_t adb_poll_mask;
|
||||
uint8_t autopoll_rate_ms;
|
||||
uint8_t autopoll;
|
||||
uint8_t data_in[128];
|
||||
uint8_t data_out[16];
|
||||
QEMUTimer *adb_poll_timer;
|
||||
} CUDAState;
|
||||
|
||||
/* MacIO */
|
||||
#define TYPE_OLDWORLD_MACIO "macio-oldworld"
|
||||
|
||||
+17
-2
@@ -369,8 +369,23 @@ static void ppc_core99_init(MachineState *machine)
|
||||
}
|
||||
|
||||
/* init basic PC hardware */
|
||||
escc_mem = escc_init(0, pic[0x25], pic[0x24],
|
||||
serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
|
||||
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", 0);
|
||||
qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 4);
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hds[0]);
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hds[1]);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", escc_serial);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", escc_serial);
|
||||
qdev_init_nofail(dev);
|
||||
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, pic[0x24]);
|
||||
sysbus_connect_irq(s, 1, pic[0x25]);
|
||||
|
||||
escc_mem = &ESCC(s)->mmio;
|
||||
|
||||
memory_region_init_alias(escc_bar, NULL, "escc-bar",
|
||||
escc_mem, 0, memory_region_size(escc_mem));
|
||||
|
||||
|
||||
+17
-2
@@ -104,6 +104,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
void *fw_cfg;
|
||||
uint64_t tbfreq;
|
||||
SysBusDevice *s;
|
||||
|
||||
linux_boot = (kernel_filename != NULL);
|
||||
|
||||
@@ -264,8 +265,22 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
get_system_io());
|
||||
pci_vga_init(pci_bus);
|
||||
|
||||
escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
|
||||
serial_hds[1], ESCC_CLOCK, 4);
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", 0);
|
||||
qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 4);
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hds[0]);
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hds[1]);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", escc_serial);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", escc_serial);
|
||||
qdev_init_nofail(dev);
|
||||
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, pic[0x10]);
|
||||
sysbus_connect_irq(s, 1, pic[0x0f]);
|
||||
|
||||
escc_mem = &ESCC(s)->mmio;
|
||||
|
||||
memory_region_init_alias(escc_bar, NULL, "escc-bar",
|
||||
escc_mem, 0, memory_region_size(escc_mem));
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* QEMU PowerPC 440 shared definitions
|
||||
*
|
||||
* Copyright (c) 2012 François Revol
|
||||
* Copyright (c) 2016-2018 BALATON Zoltan
|
||||
*
|
||||
* This work is licensed under the GNU GPL license version 2 or later.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PPC440_H
|
||||
#define PPC440_H
|
||||
|
||||
#include "hw/ppc/ppc.h"
|
||||
|
||||
void ppc4xx_l2sram_init(CPUPPCState *env);
|
||||
void ppc4xx_cpr_init(CPUPPCState *env);
|
||||
void ppc4xx_sdr_init(CPUPPCState *env);
|
||||
void ppc440_sdram_init(CPUPPCState *env, int nbanks,
|
||||
MemoryRegion *ram_memories,
|
||||
hwaddr *ram_bases, hwaddr *ram_sizes,
|
||||
int do_init);
|
||||
void ppc4xx_ahb_init(CPUPPCState *env);
|
||||
void ppc460ex_pcie_init(CPUPPCState *env);
|
||||
|
||||
#endif /* PPC440_H */
|
||||
+1159
File diff suppressed because it is too large
Load Diff
+53
-22
@@ -99,6 +99,21 @@
|
||||
|
||||
#define PHANDLE_XICP 0x00001111
|
||||
|
||||
/* These two functions implement the VCPU id numbering: one to compute them
|
||||
* all and one to identify thread 0 of a VCORE. Any change to the first one
|
||||
* is likely to have an impact on the second one, so let's keep them close.
|
||||
*/
|
||||
static int spapr_vcpu_id(sPAPRMachineState *spapr, int cpu_index)
|
||||
{
|
||||
return
|
||||
(cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads;
|
||||
}
|
||||
static bool spapr_is_thread0_in_vcore(sPAPRMachineState *spapr,
|
||||
PowerPCCPU *cpu)
|
||||
{
|
||||
return spapr_get_vcpu_id(cpu) % spapr->vsmt == 0;
|
||||
}
|
||||
|
||||
static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
|
||||
const char *type_ics,
|
||||
int nr_irqs, Error **errp)
|
||||
@@ -160,9 +175,9 @@ static void pre_2_10_vmstate_unregister_dummy_icp(int i)
|
||||
(void *)(uintptr_t) i);
|
||||
}
|
||||
|
||||
static inline int xics_max_server_number(void)
|
||||
static int xics_max_server_number(sPAPRMachineState *spapr)
|
||||
{
|
||||
return DIV_ROUND_UP(max_cpus * kvmppc_smt_threads(), smp_threads);
|
||||
return DIV_ROUND_UP(max_cpus * spapr->vsmt, smp_threads);
|
||||
}
|
||||
|
||||
static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
|
||||
@@ -194,7 +209,7 @@ static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)
|
||||
if (smc->pre_2_10_has_unused_icps) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < xics_max_server_number(); i++) {
|
||||
for (i = 0; i < xics_max_server_number(spapr); i++) {
|
||||
/* Dummy entries get deregistered when real ICPState objects
|
||||
* are registered during CPU core hotplug.
|
||||
*/
|
||||
@@ -209,7 +224,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
|
||||
int i, ret = 0;
|
||||
uint32_t servers_prop[smt_threads];
|
||||
uint32_t gservers_prop[smt_threads * 2];
|
||||
int index = spapr_vcpu_id(cpu);
|
||||
int index = spapr_get_vcpu_id(cpu);
|
||||
|
||||
if (cpu->compat_pvr) {
|
||||
ret = fdt_setprop_cell(fdt, offset, "cpu-version", cpu->compat_pvr);
|
||||
@@ -238,7 +253,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
|
||||
|
||||
static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)
|
||||
{
|
||||
int index = spapr_vcpu_id(cpu);
|
||||
int index = spapr_get_vcpu_id(cpu);
|
||||
uint32_t associativity[] = {cpu_to_be32(0x5),
|
||||
cpu_to_be32(0x0),
|
||||
cpu_to_be32(0x0),
|
||||
@@ -337,16 +352,15 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)
|
||||
int ret = 0, offset, cpus_offset;
|
||||
CPUState *cs;
|
||||
char cpu_model[32];
|
||||
int smt = kvmppc_smt_threads();
|
||||
uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
|
||||
|
||||
CPU_FOREACH(cs) {
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(cs);
|
||||
int index = spapr_vcpu_id(cpu);
|
||||
int index = spapr_get_vcpu_id(cpu);
|
||||
int compat_smt = MIN(smp_threads, ppc_compat_max_vthreads(cpu));
|
||||
|
||||
if ((index % smt) != 0) {
|
||||
if (!spapr_is_thread0_in_vcore(spapr, cpu)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -493,7 +507,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
|
||||
int index = spapr_vcpu_id(cpu);
|
||||
int index = spapr_get_vcpu_id(cpu);
|
||||
uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40),
|
||||
0xffffffff, 0xffffffff};
|
||||
uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq()
|
||||
@@ -614,7 +628,6 @@ static void spapr_populate_cpus_dt_node(void *fdt, sPAPRMachineState *spapr)
|
||||
CPUState *cs;
|
||||
int cpus_offset;
|
||||
char *nodename;
|
||||
int smt = kvmppc_smt_threads();
|
||||
|
||||
cpus_offset = fdt_add_subnode(fdt, 0, "cpus");
|
||||
_FDT(cpus_offset);
|
||||
@@ -628,11 +641,11 @@ static void spapr_populate_cpus_dt_node(void *fdt, sPAPRMachineState *spapr)
|
||||
*/
|
||||
CPU_FOREACH_REVERSE(cs) {
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
int index = spapr_vcpu_id(cpu);
|
||||
int index = spapr_get_vcpu_id(cpu);
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(cs);
|
||||
int offset;
|
||||
|
||||
if ((index % smt) != 0) {
|
||||
if (!spapr_is_thread0_in_vcore(spapr, cpu)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1131,7 +1144,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
|
||||
_FDT(fdt_setprop_cell(fdt, 0, "#size-cells", 2));
|
||||
|
||||
/* /interrupt controller */
|
||||
spapr_dt_xics(xics_max_server_number(), fdt, PHANDLE_XICP);
|
||||
spapr_dt_xics(xics_max_server_number(spapr), fdt, PHANDLE_XICP);
|
||||
|
||||
ret = spapr_populate_memory(spapr, fdt);
|
||||
if (ret < 0) {
|
||||
@@ -2224,7 +2237,6 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
|
||||
MachineState *machine = MACHINE(spapr);
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
const char *type = spapr_get_cpu_core_type(machine->cpu_type);
|
||||
int smt = kvmppc_smt_threads();
|
||||
const CPUArchIdList *possible_cpus;
|
||||
int boot_cores_nr = smp_cpus / smp_threads;
|
||||
int i;
|
||||
@@ -2254,7 +2266,7 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
|
||||
|
||||
if (mc->has_hotpluggable_cpus) {
|
||||
spapr_dr_connector_new(OBJECT(spapr), TYPE_SPAPR_DRC_CPU,
|
||||
(core_id / smp_threads) * smt);
|
||||
spapr_vcpu_id(spapr, core_id));
|
||||
}
|
||||
|
||||
if (i < boot_cores_nr) {
|
||||
@@ -3237,7 +3249,7 @@ static void *spapr_populate_hotplug_cpu_dt(CPUState *cs, int *fdt_offset,
|
||||
{
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(cs);
|
||||
int id = spapr_vcpu_id(cpu);
|
||||
int id = spapr_get_vcpu_id(cpu);
|
||||
void *fdt;
|
||||
int offset, fdt_size;
|
||||
char *nodename;
|
||||
@@ -3281,10 +3293,10 @@ static
|
||||
void spapr_core_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
Error **errp)
|
||||
{
|
||||
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
|
||||
int index;
|
||||
sPAPRDRConnector *drc;
|
||||
CPUCore *cc = CPU_CORE(dev);
|
||||
int smt = kvmppc_smt_threads();
|
||||
|
||||
if (!spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index)) {
|
||||
error_setg(errp, "Unable to find CPU core with core-id: %d",
|
||||
@@ -3296,7 +3308,8 @@ void spapr_core_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, index * smt);
|
||||
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU,
|
||||
spapr_vcpu_id(spapr, cc->core_id));
|
||||
g_assert(drc);
|
||||
|
||||
spapr_drc_detach(drc);
|
||||
@@ -3315,7 +3328,6 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
CPUState *cs = CPU(core->threads[0]);
|
||||
sPAPRDRConnector *drc;
|
||||
Error *local_err = NULL;
|
||||
int smt = kvmppc_smt_threads();
|
||||
CPUArchId *core_slot;
|
||||
int index;
|
||||
bool hotplugged = spapr_drc_hotplugged(dev);
|
||||
@@ -3326,7 +3338,8 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||
cc->core_id);
|
||||
return;
|
||||
}
|
||||
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU, index * smt);
|
||||
drc = spapr_drc_by_id(TYPE_SPAPR_DRC_CPU,
|
||||
spapr_vcpu_id(spapr, cc->core_id));
|
||||
|
||||
g_assert(drc || !mc->has_hotpluggable_cpus);
|
||||
|
||||
@@ -3795,7 +3808,7 @@ static void spapr_pic_print_info(InterruptStatsProvider *obj,
|
||||
ics_pic_print_info(spapr->ics, mon);
|
||||
}
|
||||
|
||||
int spapr_vcpu_id(PowerPCCPU *cpu)
|
||||
int spapr_get_vcpu_id(PowerPCCPU *cpu)
|
||||
{
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
@@ -3806,6 +3819,24 @@ int spapr_vcpu_id(PowerPCCPU *cpu)
|
||||
}
|
||||
}
|
||||
|
||||
void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
|
||||
{
|
||||
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
||||
int vcpu_id;
|
||||
|
||||
vcpu_id = spapr_vcpu_id(spapr, cpu_index);
|
||||
|
||||
if (kvm_enabled() && !kvm_vcpu_id_is_valid(vcpu_id)) {
|
||||
error_setg(errp, "Can't create CPU with id %d in KVM", vcpu_id);
|
||||
error_append_hint(errp, "Adjust the number of cpus to %d "
|
||||
"or try to raise the number of threads per core\n",
|
||||
vcpu_id * smp_threads / spapr->vsmt);
|
||||
return;
|
||||
}
|
||||
|
||||
cpu->vcpu_id = vcpu_id;
|
||||
}
|
||||
|
||||
PowerPCCPU *spapr_find_cpu(int vcpu_id)
|
||||
{
|
||||
CPUState *cs;
|
||||
@@ -3813,7 +3844,7 @@ PowerPCCPU *spapr_find_cpu(int vcpu_id)
|
||||
CPU_FOREACH(cs) {
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
|
||||
if (spapr_vcpu_id(cpu) == vcpu_id) {
|
||||
if (spapr_get_vcpu_id(cpu) == vcpu_id) {
|
||||
return cpu;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-17
@@ -205,7 +205,9 @@ static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t val,
|
||||
static void cap_safe_indirect_branch_apply(sPAPRMachineState *spapr,
|
||||
uint8_t val, Error **errp)
|
||||
{
|
||||
if (tcg_enabled() && val) {
|
||||
if (val == SPAPR_CAP_WORKAROUND) { /* Can only be Broken or Fixed */
|
||||
error_setg(errp, "Requested safe indirect branch capability level \"workaround\" not valid, try cap-ibs=fixed");
|
||||
} else if (tcg_enabled() && val) {
|
||||
/* TODO - for now only allow broken for TCG */
|
||||
error_setg(errp, "Requested safe indirect branch capability level not supported by tcg, try a different value for cap-ibs");
|
||||
} else if (kvm_enabled() && (val > kvmppc_get_cap_safe_indirect_branch())) {
|
||||
@@ -263,7 +265,7 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = {
|
||||
},
|
||||
[SPAPR_CAP_IBS] = {
|
||||
.name = "ibs",
|
||||
.description = "Indirect Branch Serialisation" VALUE_DESC_TRISTATE,
|
||||
.description = "Indirect Branch Serialisation (broken, fixed)",
|
||||
.index = SPAPR_CAP_IBS,
|
||||
.get = spapr_cap_get_tristate,
|
||||
.set = spapr_cap_set_tristate,
|
||||
@@ -350,34 +352,34 @@ int spapr_caps_post_migration(sPAPRMachineState *spapr)
|
||||
}
|
||||
|
||||
/* Used to generate the migration field and needed function for a spapr cap */
|
||||
#define SPAPR_CAP_MIG_STATE(cap, ccap) \
|
||||
static bool spapr_cap_##cap##_needed(void *opaque) \
|
||||
#define SPAPR_CAP_MIG_STATE(sname, cap) \
|
||||
static bool spapr_cap_##sname##_needed(void *opaque) \
|
||||
{ \
|
||||
sPAPRMachineState *spapr = opaque; \
|
||||
\
|
||||
return spapr->cmd_line_caps[SPAPR_CAP_##ccap] && \
|
||||
(spapr->eff.caps[SPAPR_CAP_##ccap] != \
|
||||
spapr->def.caps[SPAPR_CAP_##ccap]); \
|
||||
return spapr->cmd_line_caps[cap] && \
|
||||
(spapr->eff.caps[cap] != \
|
||||
spapr->def.caps[cap]); \
|
||||
} \
|
||||
\
|
||||
const VMStateDescription vmstate_spapr_cap_##cap = { \
|
||||
.name = "spapr/cap/" #cap, \
|
||||
const VMStateDescription vmstate_spapr_cap_##sname = { \
|
||||
.name = "spapr/cap/" #sname, \
|
||||
.version_id = 1, \
|
||||
.minimum_version_id = 1, \
|
||||
.needed = spapr_cap_##cap##_needed, \
|
||||
.needed = spapr_cap_##sname##_needed, \
|
||||
.fields = (VMStateField[]) { \
|
||||
VMSTATE_UINT8(mig.caps[SPAPR_CAP_##ccap], \
|
||||
VMSTATE_UINT8(mig.caps[cap], \
|
||||
sPAPRMachineState), \
|
||||
VMSTATE_END_OF_LIST() \
|
||||
}, \
|
||||
}
|
||||
|
||||
SPAPR_CAP_MIG_STATE(htm, HTM);
|
||||
SPAPR_CAP_MIG_STATE(vsx, VSX);
|
||||
SPAPR_CAP_MIG_STATE(dfp, DFP);
|
||||
SPAPR_CAP_MIG_STATE(cfpc, CFPC);
|
||||
SPAPR_CAP_MIG_STATE(sbbc, SBBC);
|
||||
SPAPR_CAP_MIG_STATE(ibs, IBS);
|
||||
SPAPR_CAP_MIG_STATE(htm, SPAPR_CAP_HTM);
|
||||
SPAPR_CAP_MIG_STATE(vsx, SPAPR_CAP_VSX);
|
||||
SPAPR_CAP_MIG_STATE(dfp, SPAPR_CAP_DFP);
|
||||
SPAPR_CAP_MIG_STATE(cfpc, SPAPR_CAP_CFPC);
|
||||
SPAPR_CAP_MIG_STATE(sbbc, SPAPR_CAP_SBBC);
|
||||
SPAPR_CAP_MIG_STATE(ibs, SPAPR_CAP_IBS);
|
||||
|
||||
void spapr_caps_reset(sPAPRMachineState *spapr)
|
||||
{
|
||||
|
||||
@@ -172,13 +172,8 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
|
||||
cs = CPU(obj);
|
||||
cpu = sc->threads[i] = POWERPC_CPU(obj);
|
||||
cs->cpu_index = cc->core_id + i;
|
||||
cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i;
|
||||
if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->vcpu_id)) {
|
||||
error_setg(&local_err, "Can't create CPU with id %d in KVM",
|
||||
cpu->vcpu_id);
|
||||
error_append_hint(&local_err, "Adjust the number of cpus to %d "
|
||||
"or try to raise the number of threads per core\n",
|
||||
cpu->vcpu_id * smp_threads / spapr->vsmt);
|
||||
spapr_set_vcpu_id(cpu, cs->cpu_index, &local_err);
|
||||
if (local_err) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -731,11 +731,21 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu,
|
||||
return H_AUTHORITY;
|
||||
}
|
||||
|
||||
if (!spapr->htab_shift) {
|
||||
/* Radix guest, no HPT */
|
||||
return H_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
trace_spapr_h_resize_hpt_commit(flags, shift);
|
||||
|
||||
rc = kvmppc_resize_hpt_commit(cpu, flags, shift);
|
||||
if (rc != -ENOSYS) {
|
||||
return resize_hpt_convert_rc(rc);
|
||||
rc = resize_hpt_convert_rc(rc);
|
||||
if (rc == H_SUCCESS) {
|
||||
/* Need to set the new htab_shift in the machine state */
|
||||
spapr->htab_shift = shift;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (flags != 0) {
|
||||
|
||||
+30
-4
@@ -818,6 +818,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
||||
DriveInfo *fd[MAX_FD];
|
||||
FWCfgState *fw_cfg;
|
||||
unsigned int num_vsimms;
|
||||
DeviceState *dev;
|
||||
SysBusDevice *s;
|
||||
|
||||
/* init CPUs */
|
||||
for(i = 0; i < smp_cpus; i++) {
|
||||
@@ -925,12 +927,36 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
||||
|
||||
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
||||
|
||||
slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[14],
|
||||
!machine->enable_graphics, ESCC_CLOCK, 1);
|
||||
/* Slavio TTYA (base+4, Linux ttyS0) is the first QEMU serial device
|
||||
Slavio TTYB (base+0, Linux ttyS1) is the second QEMU serial device */
|
||||
escc_init(hwdef->serial_base, slavio_irq[15], slavio_irq[15],
|
||||
serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", !machine->enable_graphics);
|
||||
qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 1);
|
||||
qdev_prop_set_chr(dev, "chrB", NULL);
|
||||
qdev_prop_set_chr(dev, "chrA", NULL);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", escc_mouse);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", escc_kbd);
|
||||
qdev_init_nofail(dev);
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, slavio_irq[14]);
|
||||
sysbus_connect_irq(s, 1, slavio_irq[14]);
|
||||
sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
|
||||
|
||||
dev = qdev_create(NULL, TYPE_ESCC);
|
||||
qdev_prop_set_uint32(dev, "disabled", 0);
|
||||
qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 1);
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hds[1]);
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hds[0]);
|
||||
qdev_prop_set_uint32(dev, "chnBtype", escc_serial);
|
||||
qdev_prop_set_uint32(dev, "chnAtype", escc_serial);
|
||||
qdev_init_nofail(dev);
|
||||
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(s, 0, slavio_irq[15]);
|
||||
sysbus_connect_irq(s, 1, slavio_irq[15]);
|
||||
sysbus_mmio_map(s, 0, hwdef->serial_base);
|
||||
|
||||
if (hwdef->apc_base) {
|
||||
apc_init(hwdef->apc_base, qemu_allocate_irq(cpu_halt_signal, NULL, 0));
|
||||
|
||||
+49
-5
@@ -1,14 +1,58 @@
|
||||
#ifndef HW_ESCC_H
|
||||
#define HW_ESCC_H
|
||||
|
||||
#include "chardev/char-fe.h"
|
||||
#include "chardev/char-serial.h"
|
||||
#include "ui/input.h"
|
||||
|
||||
/* escc.c */
|
||||
#define TYPE_ESCC "escc"
|
||||
#define ESCC_SIZE 4
|
||||
MemoryRegion *escc_init(hwaddr base, qemu_irq irqA, qemu_irq irqB,
|
||||
Chardev *chrA, Chardev *chrB,
|
||||
int clock, int it_shift);
|
||||
|
||||
void slavio_serial_ms_kbd_init(hwaddr base, qemu_irq irq,
|
||||
int disabled, int clock, int it_shift);
|
||||
#define ESCC(obj) OBJECT_CHECK(ESCCState, (obj), TYPE_ESCC)
|
||||
|
||||
typedef enum {
|
||||
escc_chn_a, escc_chn_b,
|
||||
} ESCCChnID;
|
||||
|
||||
typedef enum {
|
||||
escc_serial, escc_kbd, escc_mouse,
|
||||
} ESCCChnType;
|
||||
|
||||
#define ESCC_SERIO_QUEUE_SIZE 256
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[ESCC_SERIO_QUEUE_SIZE];
|
||||
int rptr, wptr, count;
|
||||
} ESCCSERIOQueue;
|
||||
|
||||
#define ESCC_SERIAL_REGS 16
|
||||
typedef struct ESCCChannelState {
|
||||
qemu_irq irq;
|
||||
uint32_t rxint, txint, rxint_under_svc, txint_under_svc;
|
||||
struct ESCCChannelState *otherchn;
|
||||
uint32_t reg;
|
||||
uint8_t wregs[ESCC_SERIAL_REGS], rregs[ESCC_SERIAL_REGS];
|
||||
ESCCSERIOQueue queue;
|
||||
CharBackend chr;
|
||||
int e0_mode, led_mode, caps_lock_mode, num_lock_mode;
|
||||
int disabled;
|
||||
int clock;
|
||||
uint32_t vmstate_dummy;
|
||||
ESCCChnID chn; /* this channel, A (base+4) or B (base+0) */
|
||||
ESCCChnType type;
|
||||
uint8_t rx, tx;
|
||||
QemuInputHandlerState *hs;
|
||||
} ESCCChannelState;
|
||||
|
||||
typedef struct ESCCState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
struct ESCCChannelState chn[2];
|
||||
uint32_t it_shift;
|
||||
MemoryRegion mmio;
|
||||
uint32_t disabled;
|
||||
uint32_t frequency;
|
||||
} ESCCState;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* QEMU PowerMac CUDA device support
|
||||
*
|
||||
* Copyright (c) 2004-2007 Fabrice Bellard
|
||||
* Copyright (c) 2007 Jocelyn Mayer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CUDA_H
|
||||
#define CUDA_H
|
||||
|
||||
/* CUDA commands (2nd byte) */
|
||||
#define CUDA_WARM_START 0x0
|
||||
#define CUDA_AUTOPOLL 0x1
|
||||
#define CUDA_GET_6805_ADDR 0x2
|
||||
#define CUDA_GET_TIME 0x3
|
||||
#define CUDA_GET_PRAM 0x7
|
||||
#define CUDA_SET_6805_ADDR 0x8
|
||||
#define CUDA_SET_TIME 0x9
|
||||
#define CUDA_POWERDOWN 0xa
|
||||
#define CUDA_POWERUP_TIME 0xb
|
||||
#define CUDA_SET_PRAM 0xc
|
||||
#define CUDA_MS_RESET 0xd
|
||||
#define CUDA_SEND_DFAC 0xe
|
||||
#define CUDA_BATTERY_SWAP_SENSE 0x10
|
||||
#define CUDA_RESET_SYSTEM 0x11
|
||||
#define CUDA_SET_IPL 0x12
|
||||
#define CUDA_FILE_SERVER_FLAG 0x13
|
||||
#define CUDA_SET_AUTO_RATE 0x14
|
||||
#define CUDA_GET_AUTO_RATE 0x16
|
||||
#define CUDA_SET_DEVICE_LIST 0x19
|
||||
#define CUDA_GET_DEVICE_LIST 0x1a
|
||||
#define CUDA_SET_ONE_SECOND_MODE 0x1b
|
||||
#define CUDA_SET_POWER_MESSAGES 0x21
|
||||
#define CUDA_GET_SET_IIC 0x22
|
||||
#define CUDA_WAKEUP 0x23
|
||||
#define CUDA_TIMER_TICKLE 0x24
|
||||
#define CUDA_COMBINED_FORMAT_IIC 0x25
|
||||
|
||||
/* Cuda */
|
||||
#define TYPE_CUDA "cuda"
|
||||
#define CUDA(obj) OBJECT_CHECK(CUDAState, (obj), TYPE_CUDA)
|
||||
|
||||
typedef struct MOS6522CUDAState MOS6522CUDAState;
|
||||
|
||||
typedef struct CUDAState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
/*< public >*/
|
||||
MemoryRegion mem;
|
||||
|
||||
ADBBusState adb_bus;
|
||||
MOS6522CUDAState *mos6522_cuda;
|
||||
|
||||
uint32_t tick_offset;
|
||||
uint64_t tb_frequency;
|
||||
|
||||
uint8_t last_b;
|
||||
uint8_t last_acr;
|
||||
|
||||
/* MacOS 9 is racy and requires a delay upon setting the SR_INT bit */
|
||||
uint64_t sr_delay_ns;
|
||||
QEMUTimer *sr_delay_timer;
|
||||
|
||||
int data_in_size;
|
||||
int data_in_index;
|
||||
int data_out_index;
|
||||
|
||||
qemu_irq irq;
|
||||
uint16_t adb_poll_mask;
|
||||
uint8_t autopoll_rate_ms;
|
||||
uint8_t autopoll;
|
||||
uint8_t data_in[128];
|
||||
uint8_t data_out[16];
|
||||
QEMUTimer *adb_poll_timer;
|
||||
} CUDAState;
|
||||
|
||||
/* MOS6522 CUDA */
|
||||
typedef struct MOS6522CUDAState {
|
||||
/*< private >*/
|
||||
MOS6522State parent_obj;
|
||||
|
||||
CUDAState *cuda;
|
||||
} MOS6522CUDAState;
|
||||
|
||||
#define TYPE_MOS6522_CUDA "mos6522-cuda"
|
||||
#define MOS6522_CUDA(obj) OBJECT_CHECK(MOS6522CUDAState, (obj), \
|
||||
TYPE_MOS6522_CUDA)
|
||||
|
||||
#endif /* CUDA_H */
|
||||
@@ -65,7 +65,7 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,
|
||||
* bit 12 - 14: function number
|
||||
* bit 0 - 11: offset in configuration space of a given device
|
||||
*/
|
||||
#define PCIE_MMCFG_SIZE_MAX (1ULL << 28)
|
||||
#define PCIE_MMCFG_SIZE_MAX (1ULL << 29)
|
||||
#define PCIE_MMCFG_SIZE_MIN (1ULL << 20)
|
||||
#define PCIE_MMCFG_BUS_BIT 20
|
||||
#define PCIE_MMCFG_BUS_MASK 0x1ff
|
||||
|
||||
@@ -766,7 +766,8 @@ void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
|
||||
|
||||
#define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift))
|
||||
|
||||
int spapr_vcpu_id(PowerPCCPU *cpu);
|
||||
int spapr_get_vcpu_id(PowerPCCPU *cpu);
|
||||
void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp);
|
||||
PowerPCCPU *spapr_find_cpu(int vcpu_id);
|
||||
|
||||
int spapr_irq_alloc(sPAPRMachineState *spapr, int irq_hint, bool lsi,
|
||||
|
||||
+203
-193
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user