cpu64.c (42f6ed919325413392bea247a1e6f135deb469cd) cpu64.c (276c6e813719568bdc9743e87ff8f42115006206)
1/*
2 * QEMU AArch64 CPU
3 *
4 * Copyright (c) 2013 Linaro Ltd
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2

--- 267 unchanged lines hidden (view full) ---

276 if (!err && (cpu->sve_max_vq == 0 || cpu->sve_max_vq > ARM_MAX_VQ)) {
277 error_setg(&err, "unsupported SVE vector length");
278 error_append_hint(&err, "Valid sve-max-vq in range [1-%d]\n",
279 ARM_MAX_VQ);
280 }
281 error_propagate(errp, err);
282}
283
1/*
2 * QEMU AArch64 CPU
3 *
4 * Copyright (c) 2013 Linaro Ltd
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2

--- 267 unchanged lines hidden (view full) ---

276 if (!err && (cpu->sve_max_vq == 0 || cpu->sve_max_vq > ARM_MAX_VQ)) {
277 error_setg(&err, "unsupported SVE vector length");
278 error_append_hint(&err, "Valid sve-max-vq in range [1-%d]\n",
279 ARM_MAX_VQ);
280 }
281 error_propagate(errp, err);
282}
283
284#ifdef CONFIG_USER_ONLY
285static void cpu_max_get_packey(Object *obj, Visitor *v, const char *name,
286 void *opaque, Error **errp)
287{
288 ARMCPU *cpu = ARM_CPU(obj);
289 const uint64_t *bit = opaque;
290 bool enabled = (cpu->env.cp15.sctlr_el[1] & *bit) != 0;
291
292 visit_type_bool(v, name, &enabled, errp);
293}
294
295static void cpu_max_set_packey(Object *obj, Visitor *v, const char *name,
296 void *opaque, Error **errp)
297{
298 ARMCPU *cpu = ARM_CPU(obj);
299 Error *err = NULL;
300 const uint64_t *bit = opaque;
301 bool enabled;
302
303 visit_type_bool(v, name, &enabled, errp);
304
305 if (!err) {
306 if (enabled) {
307 cpu->env.cp15.sctlr_el[1] |= *bit;
308 } else {
309 cpu->env.cp15.sctlr_el[1] &= ~*bit;
310 }
311 }
312 error_propagate(errp, err);
313}
314#endif
315
316/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
317 * otherwise, a CPU with as many features enabled as our emulation supports.
318 * The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
319 * this only needs to handle 64 bits.
320 */
321static void aarch64_max_initfn(Object *obj)
322{
323 ARMCPU *cpu = ARM_CPU(obj);

--- 59 unchanged lines hidden (view full) ---

383 */
384
385#ifdef CONFIG_USER_ONLY
386 /* For usermode -cpu max we can use a larger and more efficient DCZ
387 * blocksize since we don't have to follow what the hardware does.
388 */
389 cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
390 cpu->dcz_blocksize = 7; /* 512 bytes */
284/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
285 * otherwise, a CPU with as many features enabled as our emulation supports.
286 * The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
287 * this only needs to handle 64 bits.
288 */
289static void aarch64_max_initfn(Object *obj)
290{
291 ARMCPU *cpu = ARM_CPU(obj);

--- 59 unchanged lines hidden (view full) ---

351 */
352
353#ifdef CONFIG_USER_ONLY
354 /* For usermode -cpu max we can use a larger and more efficient DCZ
355 * blocksize since we don't have to follow what the hardware does.
356 */
357 cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
358 cpu->dcz_blocksize = 7; /* 512 bytes */
391
392 /*
393 * Note that Linux will enable enable all of the keys at once.
394 * But doing it this way will allow experimentation beyond that.
395 */
396 {
397 static const uint64_t apia_bit = SCTLR_EnIA;
398 static const uint64_t apib_bit = SCTLR_EnIB;
399 static const uint64_t apda_bit = SCTLR_EnDA;
400 static const uint64_t apdb_bit = SCTLR_EnDB;
401
402 object_property_add(obj, "apia", "bool", cpu_max_get_packey,
403 cpu_max_set_packey, NULL,
404 (void *)&apia_bit, &error_fatal);
405 object_property_add(obj, "apib", "bool", cpu_max_get_packey,
406 cpu_max_set_packey, NULL,
407 (void *)&apib_bit, &error_fatal);
408 object_property_add(obj, "apda", "bool", cpu_max_get_packey,
409 cpu_max_set_packey, NULL,
410 (void *)&apda_bit, &error_fatal);
411 object_property_add(obj, "apdb", "bool", cpu_max_get_packey,
412 cpu_max_set_packey, NULL,
413 (void *)&apdb_bit, &error_fatal);
414
415 /* Enable all PAC keys by default. */
416 cpu->env.cp15.sctlr_el[1] |= SCTLR_EnIA | SCTLR_EnIB;
417 cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB;
418 }
419#endif
420
421 cpu->sve_max_vq = ARM_MAX_VQ;
422 object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_vq,
423 cpu_max_set_sve_vq, NULL, NULL, &error_fatal);
424 }
425}
426

--- 128 unchanged lines hidden ---
359#endif
360
361 cpu->sve_max_vq = ARM_MAX_VQ;
362 object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_vq,
363 cpu_max_set_sve_vq, NULL, NULL, &error_fatal);
364 }
365}
366

--- 128 unchanged lines hidden ---