* fall back to non-ioeventfd notification if KVM routing table is full

* support kitware ninja with jobserver support
 * nanomips: fix warnings with GCC 14
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmYURBsUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroNuygf8DzxNFSPCKatkiZ0HSekMUcM6+vCf
 fcQx+PEmgnBGTMaeMqUMFGRBPx1FdrvvLpV0oeJ1RvyfyZLCEmRMaO9LnzkqlYgD
 jd5R4/mQcbH+qpZyk5x+g10gHLzafXHYf/aBVkzqlO02UyO61lgpoXp/Z1l+jkhB
 1FA8Y3NH5x1gqT37pSCYUIeIAfoY1mndjsPNa/IuDUlMk0jwKz2zEWWYkQF2DvY0
 nfZG2+V7YdOBv+vkZi2gcl82FWAJdsZF+cMBmshvYp+N3/JKezgB588vJ3Yu3UVV
 Y3Z/GbbqS+mCFBe2M6TsL7eU18UgU5E8mXB6Lp8fOGTwIG8iM0tcBYBc0g==
 =qHqi
 -----END PGP SIGNATURE-----

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* fall back to non-ioeventfd notification if KVM routing table is full
* support kitware ninja with jobserver support
* nanomips: fix warnings with GCC 14

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmYURBsUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroNuygf8DzxNFSPCKatkiZ0HSekMUcM6+vCf
# fcQx+PEmgnBGTMaeMqUMFGRBPx1FdrvvLpV0oeJ1RvyfyZLCEmRMaO9LnzkqlYgD
# jd5R4/mQcbH+qpZyk5x+g10gHLzafXHYf/aBVkzqlO02UyO61lgpoXp/Z1l+jkhB
# 1FA8Y3NH5x1gqT37pSCYUIeIAfoY1mndjsPNa/IuDUlMk0jwKz2zEWWYkQF2DvY0
# nfZG2+V7YdOBv+vkZi2gcl82FWAJdsZF+cMBmshvYp+N3/JKezgB588vJ3Yu3UVV
# Y3Z/GbbqS+mCFBe2M6TsL7eU18UgU5E8mXB6Lp8fOGTwIG8iM0tcBYBc0g==
# =qHqi
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 08 Apr 2024 20:23:07 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  kvm: error out of kvm_irqchip_add_msi_route() in case of full route table
  nanomips: fix warnings with GCC 14
  Makefile: preserve --jobserver-auth argument when calling ninja

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2024-04-09 09:51:00 +01:00
commit 98cd02f393
3 changed files with 108 additions and 103 deletions

View File

@ -142,7 +142,7 @@ MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
$(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
$(or $(filter -l% -j%, $(MAKEFLAGS)), $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1)) \
-d keepdepfile
ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))

View File

@ -1999,12 +1999,17 @@ int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)
return -EINVAL;
}
trace_kvm_irqchip_add_msi_route(dev ? dev->name : (char *)"N/A",
vector, virq);
if (s->irq_routes->nr < s->gsi_count) {
trace_kvm_irqchip_add_msi_route(dev ? dev->name : (char *)"N/A",
vector, virq);
kvm_add_routing_entry(s, &kroute);
kvm_arch_add_msi_route_post(&kroute, vector, dev);
c->changes++;
kvm_add_routing_entry(s, &kroute);
kvm_arch_add_msi_route_post(&kroute, vector, dev);
c->changes++;
} else {
kvm_irqchip_release_virq(s, virq);
return -ENOSPC;
}
return virq;
}

View File

@ -36,35 +36,6 @@ typedef uint32_t uint32;
typedef uint16_t uint16;
typedef uint64_t img_address;
typedef enum {
instruction,
call_instruction,
branch_instruction,
return_instruction,
reserved_block,
pool,
} TABLE_ENTRY_TYPE;
typedef enum {
MIPS64_ = 0x00000001,
XNP_ = 0x00000002,
XMMS_ = 0x00000004,
EVA_ = 0x00000008,
DSP_ = 0x00000010,
MT_ = 0x00000020,
EJTAG_ = 0x00000040,
TLBINV_ = 0x00000080,
CP0_ = 0x00000100,
CP1_ = 0x00000200,
CP2_ = 0x00000400,
UDI_ = 0x00000800,
MCU_ = 0x00001000,
VZ_ = 0x00002000,
TLB_ = 0x00004000,
MVH_ = 0x00008000,
ALL_ATTRIBUTES = 0xffffffffull,
} TABLE_ATTRIBUTE_TYPE;
typedef struct Dis_info {
img_address m_pc;
fprintf_function fprintf_func;
@ -72,22 +43,6 @@ typedef struct Dis_info {
sigjmp_buf buf;
} Dis_info;
typedef bool (*conditional_function)(uint64 instruction);
typedef char * (*disassembly_function)(uint64 instruction,
Dis_info *info);
typedef struct Pool {
TABLE_ENTRY_TYPE type;
const struct Pool *next_table;
int next_table_size;
int instructions_size;
uint64 mask;
uint64 value;
disassembly_function disassembly;
conditional_function condition;
uint64 attributes;
} Pool;
#define IMGASSERTONCE(test)
@ -544,58 +499,6 @@ static uint64 extract_op_code_value(const uint16 *data, int size)
}
/*
* Recurse through tables until the instruction is found then return
* the string and size
*
* inputs:
* pointer to a word stream,
* disassember table and size
* returns:
* instruction size - negative is error
* disassembly string - on error will constain error string
*/
static int Disassemble(const uint16 *data, char **dis,
TABLE_ENTRY_TYPE *type, const Pool *table,
int table_size, Dis_info *info)
{
for (int i = 0; i < table_size; i++) {
uint64 op_code = extract_op_code_value(data,
table[i].instructions_size);
if ((op_code & table[i].mask) == table[i].value) {
/* possible match */
conditional_function cond = table[i].condition;
if ((cond == NULL) || cond(op_code)) {
if (table[i].type == pool) {
return Disassemble(data, dis, type,
table[i].next_table,
table[i].next_table_size,
info);
} else if ((table[i].type == instruction) ||
(table[i].type == call_instruction) ||
(table[i].type == branch_instruction) ||
(table[i].type == return_instruction)) {
disassembly_function dis_fn = table[i].disassembly;
if (dis_fn == 0) {
*dis = g_strdup(
"disassembler failure - bad table entry");
return -6;
}
*type = table[i].type;
*dis = dis_fn(op_code, info);
return table[i].instructions_size;
} else {
*dis = g_strdup("reserved instruction");
return -2;
}
}
}
}
*dis = g_strdup("failed to disassemble");
return -1; /* failed to disassemble */
}
static uint64 extract_code_18_to_0(uint64 instruction)
{
uint64 value = 0;
@ -16213,6 +16116,51 @@ static char *YIELD(uint64 instruction, Dis_info *info)
*
*/
typedef enum {
instruction,
call_instruction,
branch_instruction,
return_instruction,
reserved_block,
pool,
} TABLE_ENTRY_TYPE;
typedef enum {
MIPS64_ = 0x00000001,
XNP_ = 0x00000002,
XMMS_ = 0x00000004,
EVA_ = 0x00000008,
DSP_ = 0x00000010,
MT_ = 0x00000020,
EJTAG_ = 0x00000040,
TLBINV_ = 0x00000080,
CP0_ = 0x00000100,
CP1_ = 0x00000200,
CP2_ = 0x00000400,
UDI_ = 0x00000800,
MCU_ = 0x00001000,
VZ_ = 0x00002000,
TLB_ = 0x00004000,
MVH_ = 0x00008000,
ALL_ATTRIBUTES = 0xffffffffull,
} TABLE_ATTRIBUTE_TYPE;
typedef bool (*conditional_function)(uint64 instruction);
typedef char * (*disassembly_function)(uint64 instruction,
Dis_info *info);
typedef struct Pool {
TABLE_ENTRY_TYPE type;
const struct Pool *next_table;
int next_table_size;
int instructions_size;
uint64 mask;
uint64 value;
disassembly_function disassembly;
conditional_function condition;
uint64 attributes;
} Pool;
static const Pool P_SYSCALL[2] = {
{ instruction , 0 , 0 , 32,
0xfffc0000, 0x00080000, &SYSCALL_32_ , 0,
@ -21907,6 +21855,58 @@ static const Pool MAJOR[2] = {
0x0 }, /* P16 */
};
/*
* Recurse through tables until the instruction is found then return
* the string and size
*
* inputs:
* pointer to a word stream,
* disassember table and size
* returns:
* instruction size - negative is error
* disassembly string - on error will constain error string
*/
static int Disassemble(const uint16 *data, char **dis,
TABLE_ENTRY_TYPE *type, const Pool *table,
int table_size, Dis_info *info)
{
for (int i = 0; i < table_size; i++) {
uint64 op_code = extract_op_code_value(data,
table[i].instructions_size);
if ((op_code & table[i].mask) == table[i].value) {
/* possible match */
conditional_function cond = table[i].condition;
if ((cond == NULL) || cond(op_code)) {
if (table[i].type == pool) {
return Disassemble(data, dis, type,
table[i].next_table,
table[i].next_table_size,
info);
} else if ((table[i].type == instruction) ||
(table[i].type == call_instruction) ||
(table[i].type == branch_instruction) ||
(table[i].type == return_instruction)) {
disassembly_function dis_fn = table[i].disassembly;
if (dis_fn == 0) {
*dis = g_strdup(
"disassembler failure - bad table entry");
return -6;
}
*type = table[i].type;
*dis = dis_fn(op_code, info);
return table[i].instructions_size;
} else {
*dis = g_strdup("reserved instruction");
return -2;
}
}
}
}
*dis = g_strdup("failed to disassemble");
return -1; /* failed to disassemble */
}
static bool nanomips_dis(const uint16_t *data, char **buf, Dis_info *info)
{
TABLE_ENTRY_TYPE type;