~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/ppc/spapr_rtas.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#define TOKEN_BASE      0x2000
39
39
#define TOKEN_MAX       0x100
40
40
 
41
 
static void rtas_display_character(sPAPREnvironment *spapr,
 
41
static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr,
42
42
                                   uint32_t token, uint32_t nargs,
43
43
                                   target_ulong args,
44
44
                                   uint32_t nret, target_ulong rets)
54
54
    }
55
55
}
56
56
 
57
 
static void rtas_get_time_of_day(sPAPREnvironment *spapr,
 
57
static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,
58
58
                                 uint32_t token, uint32_t nargs,
59
59
                                 target_ulong args,
60
60
                                 uint32_t nret, target_ulong rets)
78
78
    rtas_st(rets, 7, 0); /* we don't do nanoseconds */
79
79
}
80
80
 
81
 
static void rtas_set_time_of_day(sPAPREnvironment *spapr,
 
81
static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr,
82
82
                                 uint32_t token, uint32_t nargs,
83
83
                                 target_ulong args,
84
84
                                 uint32_t nret, target_ulong rets)
99
99
    rtas_st(rets, 0, 0); /* Success */
100
100
}
101
101
 
102
 
static void rtas_power_off(sPAPREnvironment *spapr,
 
102
static void rtas_power_off(PowerPCCPU *cpu, sPAPREnvironment *spapr,
103
103
                           uint32_t token, uint32_t nargs, target_ulong args,
104
104
                           uint32_t nret, target_ulong rets)
105
105
{
111
111
    rtas_st(rets, 0, 0);
112
112
}
113
113
 
114
 
static void rtas_system_reboot(sPAPREnvironment *spapr,
 
114
static void rtas_system_reboot(PowerPCCPU *cpu, sPAPREnvironment *spapr,
115
115
                               uint32_t token, uint32_t nargs,
116
116
                               target_ulong args,
117
117
                               uint32_t nret, target_ulong rets)
124
124
    rtas_st(rets, 0, 0);
125
125
}
126
126
 
127
 
static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
 
127
static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_,
 
128
                                         sPAPREnvironment *spapr,
128
129
                                         uint32_t token, uint32_t nargs,
129
130
                                         target_ulong args,
130
131
                                         uint32_t nret, target_ulong rets)
131
132
{
132
133
    target_ulong id;
133
 
    CPUPPCState *env;
134
134
    CPUState *cpu;
135
135
 
136
136
    if (nargs != 1 || nret != 2) {
139
139
    }
140
140
 
141
141
    id = rtas_ld(args, 0);
142
 
    for (env = first_cpu; env; env = env->next_cpu) {
143
 
        cpu = CPU(ppc_env_get_cpu(env));
144
 
        if (cpu->cpu_index != id) {
145
 
            continue;
146
 
        }
147
 
 
 
142
    cpu = qemu_get_cpu(id);
 
143
    if (cpu != NULL) {
148
144
        if (cpu->halted) {
149
145
            rtas_st(rets, 1, 0);
150
146
        } else {
159
155
    rtas_st(rets, 0, -3);
160
156
}
161
157
 
162
 
static void rtas_start_cpu(sPAPREnvironment *spapr,
 
158
static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr,
163
159
                           uint32_t token, uint32_t nargs,
164
160
                           target_ulong args,
165
161
                           uint32_t nret, target_ulong rets)
166
162
{
167
163
    target_ulong id, start, r3;
168
 
    CPUState *cpu;
169
 
    CPUPPCState *env;
 
164
    CPUState *cs;
170
165
 
171
166
    if (nargs != 3 || nret != 1) {
172
167
        rtas_st(rets, 0, -3);
177
172
    start = rtas_ld(args, 1);
178
173
    r3 = rtas_ld(args, 2);
179
174
 
180
 
    for (env = first_cpu; env; env = env->next_cpu) {
181
 
        cpu = CPU(ppc_env_get_cpu(env));
182
 
 
183
 
        if (cpu->cpu_index != id) {
184
 
            continue;
185
 
        }
186
 
 
187
 
        if (!cpu->halted) {
 
175
    cs = qemu_get_cpu(id);
 
176
    if (cs != NULL) {
 
177
        PowerPCCPU *cpu = POWERPC_CPU(cs);
 
178
        CPUPPCState *env = &cpu->env;
 
179
 
 
180
        if (!cs->halted) {
188
181
            rtas_st(rets, 0, -1);
189
182
            return;
190
183
        }
192
185
        /* This will make sure qemu state is up to date with kvm, and
193
186
         * mark it dirty so our changes get flushed back before the
194
187
         * new cpu enters */
195
 
        kvm_cpu_synchronize_state(env);
 
188
        kvm_cpu_synchronize_state(cs);
196
189
 
197
190
        env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
198
191
        env->nip = start;
199
192
        env->gpr[3] = r3;
200
 
        cpu->halted = 0;
 
193
        cs->halted = 0;
201
194
 
202
 
        qemu_cpu_kick(cpu);
 
195
        qemu_cpu_kick(cs);
203
196
 
204
197
        rtas_st(rets, 0, 0);
205
198
        return;
216
209
 
217
210
struct rtas_call *rtas_next = rtas_table;
218
211
 
219
 
target_ulong spapr_rtas_call(sPAPREnvironment *spapr,
 
212
target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr,
220
213
                             uint32_t token, uint32_t nargs, target_ulong args,
221
214
                             uint32_t nret, target_ulong rets)
222
215
{
225
218
        struct rtas_call *call = rtas_table + (token - TOKEN_BASE);
226
219
 
227
220
        if (call->fn) {
228
 
            call->fn(spapr, token, nargs, args, nret, rets);
 
221
            call->fn(cpu, spapr, token, nargs, args, nret, rets);
229
222
            return H_SUCCESS;
230
223
        }
231
224
    }
235
228
     * machines) without looking it up in the device tree.  This
236
229
     * special case makes this work */
237
230
    if (token == 0xa) {
238
 
        rtas_display_character(spapr, 0xa, nargs, args, nret, rets);
 
231
        rtas_display_character(cpu, spapr, 0xa, nargs, args, nret, rets);
239
232
        return H_SUCCESS;
240
233
    }
241
234