target-arm queue:

* hw/arm/virt: ARM_VIRT must select ARM_GIC
  * exynos: Fix bad printf format specifiers
  * hw/input/ps2.c: Remove remnants of printf debug
  * target/openrisc: Remove dead code attempting to check "is timer disabled"
  * register: Remove unnecessary NULL check
  * util/cutils: Fix Coverity array overrun in freq_to_str()
  * configure: Make "does libgio work" test pull in some actual functions
  * tmp105: reset the T_low and T_High registers
  * tmp105: Correct handling of temperature limit checks
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAl+z1IQZHHBldGVyLm1h
 eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3klxD/92P/CHcPvcu7tKr9KVD0Df
 qwHO3LLUOxmuNrNsZV3sjKYG9rZRpi3S10YDfCSbcaDjmHG2d6gmTFRXti0TALyy
 GXu7J21xEuzQ35Wh71Jg7pR925lQO6uw0PsEDQnCOc1xj3d8lXzt4ojBI22e5Iw4
 /33mgCaHIolbgXgD2uVoLvWz/YrNLZQN+4WFAdktNA/sf7RMbvh+hyxsoBRQ1ggS
 5lyBI3QpY5Ac4BdDYhmMq8U6f5zA67hgt/piqH2O2Akq57kqKTS4GaXQFuCESSE6
 kLIxKKBxW1hQXzp7fqsomdsu3E+ZbzOkAqKDlm/T33ruAHNCEtouoMwIcgBenqxE
 O11ddYhs3xhWO47S1YyTp4ML+e2P4o+uISXS4D7BCStKkfFOAXyzTaROAHnK1bTJ
 WyGrPaFfI8a6ubQFrlm2c36tkm3frLxzK6YnOAuxEpgE7ZyoYyjQsPfkDIas04Od
 Mn/8fCp+SfQwwspfRQK7ohaLbxzmi0pW/dqG9HSol1xCZa6+vtNjers2SPjVyVM3
 XV2kAQYph44VmK7e1FXcJFRA9W7HIxlt6fiGB2jWWp6yQuly/7X9OPT1Omy0vmSG
 L65UNBNKC21I6rEiGBY3Tn0INlHxzUNcgxO1Zd/jOxgoUF90D6+3/Es+U1fm6O77
 H4s7EfNhfamgln4wLUyF4Q==
 =LjX0
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20201117' into staging

target-arm queue:
 * hw/arm/virt: ARM_VIRT must select ARM_GIC
 * exynos: Fix bad printf format specifiers
 * hw/input/ps2.c: Remove remnants of printf debug
 * target/openrisc: Remove dead code attempting to check "is timer disabled"
 * register: Remove unnecessary NULL check
 * util/cutils: Fix Coverity array overrun in freq_to_str()
 * configure: Make "does libgio work" test pull in some actual functions
 * tmp105: reset the T_low and T_High registers
 * tmp105: Correct handling of temperature limit checks

# gpg: Signature made Tue 17 Nov 2020 13:47:48 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20201117:
  tmp105: Correct handling of temperature limit checks
  hw/misc/tmp105: reset the T_low and T_High registers
  configure: Make "does libgio work" test pull in some actual functions
  util/cutils: Fix Coverity array overrun in freq_to_str()
  register: Remove unnecessary NULL check
  target/openrisc: Remove dead code attempting to check "is timer disabled"
  hw/input/ps2.c: Remove remnants of printf debug
  exynos: Fix bad printf format specifiers
  hw/arm/virt: ARM_VIRT must select ARM_GIC

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-11-17 16:41:47 +00:00
commit c446ac37b7
10 changed files with 89 additions and 34 deletions

11
configure vendored
View File

@ -3505,8 +3505,15 @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
# Check that the libraries actually work -- Ubuntu 18.04 ships
# with pkg-config --static --libs data for gio-2.0 that is missing
# -lblkid and will give a link error.
write_c_skeleton
if compile_prog "" "$gio_libs" ; then
cat > $TMPC <<EOF
#include <gio/gio.h>
int main(void)
{
g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
return 0;
}
EOF
if compile_prog "$gio_cflags" "$gio_libs" ; then
gio=yes
else
gio=no

View File

@ -6,6 +6,7 @@ config ARM_VIRT
imply VFIO_PLATFORM
imply VFIO_XGMAC
imply TPM_TIS_SYSBUS
select ARM_GIC
select ACPI
select ARM_SMMUV3
select GPIO_KEY

View File

@ -258,10 +258,6 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
int index = rae[i].addr / data_size;
RegisterInfo *r = &ri[index];
if (data + data_size * index == 0 || !&rae[i]) {
continue;
}
/* Init the register, this will zero it. */
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);

View File

@ -33,12 +33,6 @@
#include "trace.h"
/* debug PC keyboard */
//#define DEBUG_KBD
/* debug PC keyboard : only mouse */
//#define DEBUG_MOUSE
/* Keyboard Commands */
#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */
#define KBD_CMD_ECHO 0xEE
@ -790,9 +784,6 @@ void ps2_write_mouse(void *opaque, int val)
PS2MouseState *s = (PS2MouseState *)opaque;
trace_ps2_write_mouse(opaque, val);
#ifdef DEBUG_MOUSE
printf("kbd: write mouse 0x%02x\n", val);
#endif
switch(s->common.write_cmd) {
default:
case -1:

View File

@ -41,16 +41,40 @@ static void tmp105_alarm_update(TMP105State *s)
return;
}
if ((s->config >> 1) & 1) { /* TM */
if (s->temperature >= s->limit[1])
s->alarm = 1;
else if (s->temperature < s->limit[0])
s->alarm = 1;
if (s->config >> 1 & 1) {
/*
* TM == 1 : Interrupt mode. We signal Alert when the
* temperature rises above T_high, and expect the guest to clear
* it (eg by reading a device register).
*/
if (s->detect_falling) {
if (s->temperature < s->limit[0]) {
s->alarm = 1;
s->detect_falling = false;
}
} else {
if (s->temperature >= s->limit[1]) {
s->alarm = 1;
s->detect_falling = true;
}
}
} else {
if (s->temperature >= s->limit[1])
s->alarm = 1;
else if (s->temperature < s->limit[0])
s->alarm = 0;
/*
* TM == 0 : Comparator mode. We signal Alert when the temperature
* rises above T_high, and stop signalling it when the temperature
* falls below T_low.
*/
if (s->detect_falling) {
if (s->temperature < s->limit[0]) {
s->alarm = 0;
s->detect_falling = false;
}
} else {
if (s->temperature >= s->limit[1]) {
s->alarm = 1;
s->detect_falling = true;
}
}
}
tmp105_interrupt_update(s);
@ -197,6 +221,29 @@ static int tmp105_post_load(void *opaque, int version_id)
return 0;
}
static bool detect_falling_needed(void *opaque)
{
TMP105State *s = opaque;
/*
* We only need to migrate the detect_falling bool if it's set;
* for migration from older machines we assume that it is false
* (ie temperature is not out of range).
*/
return s->detect_falling;
}
static const VMStateDescription vmstate_tmp105_detect_falling = {
.name = "TMP105/detect-falling",
.version_id = 1,
.minimum_version_id = 1,
.needed = detect_falling_needed,
.fields = (VMStateField[]) {
VMSTATE_BOOL(detect_falling, TMP105State),
VMSTATE_END_OF_LIST()
}
};
static const VMStateDescription vmstate_tmp105 = {
.name = "TMP105",
.version_id = 0,
@ -212,6 +259,10 @@ static const VMStateDescription vmstate_tmp105 = {
VMSTATE_UINT8(alarm, TMP105State),
VMSTATE_I2C_SLAVE(i2c, TMP105State),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription*[]) {
&vmstate_tmp105_detect_falling,
NULL
}
};
@ -224,6 +275,10 @@ static void tmp105_reset(I2CSlave *i2c)
s->config = 0;
s->faults = tmp105_faultq[(s->config >> 3) & 3];
s->alarm = 0;
s->detect_falling = false;
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
tmp105_interrupt_update(s);
}

View File

@ -43,6 +43,13 @@ struct TMP105State {
int16_t limit[2];
int faults;
uint8_t alarm;
/*
* The TMP105 initially looks for a temperature rising above T_high;
* once this is detected, the condition it looks for next is the
* temperature falling below T_low. This flag is false when initially
* looking for T_high, true when looking for T_low.
*/
bool detect_falling;
};
#endif

View File

@ -537,7 +537,7 @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
/* If CSTAT is pending and IRQ is enabled */
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
(s->reg.int_enb & G_INT_ENABLE(id))) {
DPRINTF("gcmp timer[%d] IRQ\n", id);
DPRINTF("gcmp timer[%u] IRQ\n", id);
qemu_irq_raise(s->irq[id]);
}
}
@ -1003,7 +1003,7 @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
if (freq != s->freq) {
DPRINTF("freq=%dHz\n", s->freq);
DPRINTF("freq=%uHz\n", s->freq);
/* global timer */
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);

View File

@ -169,7 +169,7 @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
if (freq != s->timer[id].freq) {
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
DPRINTF("freq=%dHz\n", s->timer[id].freq);
DPRINTF("freq=%uHz\n", s->timer[id].freq);
}
}
@ -183,14 +183,14 @@ static void exynos4210_pwm_tick(void *opaque)
uint32_t id = s->id;
bool cmp;
DPRINTF("timer %d tick\n", id);
DPRINTF("timer %u tick\n", id);
/* set irq status */
p->reg_tint_cstat |= TINT_CSTAT_STATUS(id);
/* raise IRQ */
if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) {
DPRINTF("timer %d IRQ\n", id);
DPRINTF("timer %u IRQ\n", id);
qemu_irq_raise(p->timer[id].irq);
}
@ -202,7 +202,7 @@ static void exynos4210_pwm_tick(void *opaque)
}
if (cmp) {
DPRINTF("auto reload timer %d count to %x\n", id,
DPRINTF("auto reload timer %u count to %x\n", id,
p->timer[id].reg_tcntb);
ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb);
ptimer_run(p->timer[id].ptimer, 1);

View File

@ -176,9 +176,6 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
case TO_SPR(10, 1): /* TTCR */
cpu_openrisc_count_set(cpu, rb);
if (env->ttmr & TIMER_NONE) {
return;
}
cpu_openrisc_timer_update(cpu);
break;
#endif

View File

@ -891,10 +891,11 @@ char *freq_to_str(uint64_t freq_hz)
double freq = freq_hz;
size_t idx = 0;
while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
while (freq >= 1000.0) {
freq /= 1000.0;
idx++;
}
assert(idx < ARRAY_SIZE(suffixes));
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
}