2018-12-13 13:32:06 +00:00
|
|
|
/*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2008-05-16 16:51:30 +00:00
|
|
|
|
2019-06-18 16:13:14 +00:00
|
|
|
#pragma once
|
2018-12-13 13:32:06 +00:00
|
|
|
|
2019-06-18 16:13:14 +00:00
|
|
|
#ifdef WITH_QEMU
|
2018-12-13 13:32:06 +00:00
|
|
|
|
2019-06-18 16:13:14 +00:00
|
|
|
# include "capabilities.h"
|
|
|
|
# include "virfilecache.h"
|
|
|
|
# include "domain_conf.h"
|
|
|
|
# include "qemu/qemu_capabilities.h"
|
|
|
|
# include "qemu/qemu_conf.h"
|
2008-05-16 16:51:30 +00:00
|
|
|
|
2019-06-18 16:13:14 +00:00
|
|
|
# define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
|
2019-04-16 10:22:31 +00:00
|
|
|
|
2016-05-10 09:35:43 +00:00
|
|
|
enum {
|
|
|
|
GIC_NONE = 0,
|
|
|
|
GIC_V2,
|
|
|
|
GIC_V3,
|
|
|
|
GIC_BOTH,
|
|
|
|
};
|
|
|
|
|
2019-03-31 15:49:34 +00:00
|
|
|
typedef enum {
|
2021-08-17 11:51:11 +00:00
|
|
|
ARG_QEMU_CAPS = QEMU_CAPS_LAST + 1,
|
2019-03-31 15:49:34 +00:00
|
|
|
ARG_GIC,
|
|
|
|
ARG_MIGRATE_FROM,
|
|
|
|
ARG_MIGRATE_FD,
|
|
|
|
ARG_FLAGS,
|
|
|
|
ARG_PARSEFLAGS,
|
|
|
|
ARG_CAPS_ARCH,
|
|
|
|
ARG_CAPS_VER,
|
|
|
|
ARG_END,
|
|
|
|
} testQemuInfoArgName;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
FLAG_EXPECT_FAILURE = 1 << 0,
|
|
|
|
FLAG_EXPECT_PARSE_ERROR = 1 << 1,
|
2020-10-21 08:08:11 +00:00
|
|
|
FLAG_FIPS_HOST = 1 << 2, /* simulate host with FIPS mode enabled */
|
2019-03-31 15:49:34 +00:00
|
|
|
FLAG_REAL_CAPS = 1 << 3,
|
|
|
|
FLAG_SKIP_LEGACY_CPUS = 1 << 4,
|
2019-08-08 14:55:14 +00:00
|
|
|
FLAG_SLIRP_HELPER = 1 << 5,
|
2019-03-31 15:49:34 +00:00
|
|
|
} testQemuInfoFlags;
|
|
|
|
|
2021-08-17 14:26:58 +00:00
|
|
|
struct testQemuConf {
|
|
|
|
GHashTable *capscache;
|
|
|
|
GHashTable *capslatest;
|
|
|
|
GHashTable *qapiSchemaCache;
|
|
|
|
};
|
|
|
|
|
2021-08-17 13:30:44 +00:00
|
|
|
struct testQemuArgs {
|
|
|
|
bool newargs;
|
|
|
|
virQEMUCaps *fakeCaps;
|
|
|
|
bool fakeCapsUsed;
|
|
|
|
char *capsver;
|
|
|
|
char *capsarch;
|
|
|
|
int gic;
|
|
|
|
bool invalidarg;
|
|
|
|
};
|
|
|
|
|
2019-03-31 15:49:34 +00:00
|
|
|
struct testQemuInfo {
|
|
|
|
const char *name;
|
|
|
|
char *infile;
|
|
|
|
char *outfile;
|
2020-09-22 11:57:39 +00:00
|
|
|
char *errfile;
|
2021-03-11 07:16:13 +00:00
|
|
|
virQEMUCaps *qemuCaps;
|
2019-03-31 15:49:34 +00:00
|
|
|
const char *migrateFrom;
|
|
|
|
int migrateFd;
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int parseFlags;
|
2019-10-24 15:51:42 +00:00
|
|
|
virArch arch;
|
2020-05-15 12:33:10 +00:00
|
|
|
char *schemafile;
|
2021-08-17 14:26:58 +00:00
|
|
|
|
2021-08-17 13:30:44 +00:00
|
|
|
struct testQemuArgs args;
|
2021-08-17 14:26:58 +00:00
|
|
|
struct testQemuConf *conf;
|
2019-03-31 15:49:34 +00:00
|
|
|
};
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virCaps *testQemuCapsInit(void);
|
|
|
|
virDomainXMLOption *testQemuXMLConfInit(void);
|
2014-06-27 14:39:27 +00:00
|
|
|
|
2018-04-04 07:17:52 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virQEMUCaps *qemuTestParseCapabilitiesArch(virArch arch,
|
2018-04-04 07:17:52 +00:00
|
|
|
const char *capsFile);
|
2015-03-23 16:19:28 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
extern virCPUDef *cpuDefault;
|
|
|
|
extern virCPUDef *cpuHaswell;
|
|
|
|
extern virCPUDef *cpuPower8;
|
|
|
|
extern virCPUDef *cpuPower9;
|
2016-08-04 11:16:55 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void qemuTestSetHostArch(virQEMUDriver *driver,
|
2019-11-26 17:51:22 +00:00
|
|
|
virArch arch);
|
2021-03-11 07:16:13 +00:00
|
|
|
void qemuTestSetHostCPU(virQEMUDriver *driver,
|
2019-11-29 10:40:39 +00:00
|
|
|
virArch arch,
|
2021-03-11 07:16:13 +00:00
|
|
|
virCPUDef *cpu);
|
2015-03-23 16:19:28 +00:00
|
|
|
|
2015-09-15 06:16:02 +00:00
|
|
|
int qemuTestDriverInit(virQEMUDriver *driver);
|
|
|
|
void qemuTestDriverFree(virQEMUDriver *driver);
|
2021-03-11 07:16:13 +00:00
|
|
|
int qemuTestCapsCacheInsert(virFileCache *cache,
|
|
|
|
virQEMUCaps *caps);
|
2015-09-09 14:03:14 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int testQemuCapsSetGIC(virQEMUCaps *qemuCaps,
|
2016-05-10 09:35:43 +00:00
|
|
|
int gic);
|
2018-04-18 08:47:31 +00:00
|
|
|
|
2019-04-16 10:26:22 +00:00
|
|
|
char *testQemuGetLatestCapsForArch(const char *arch,
|
2018-04-18 08:47:31 +00:00
|
|
|
const char *suffix);
|
2020-10-22 17:04:18 +00:00
|
|
|
GHashTable *testQemuGetLatestCaps(void);
|
2018-04-18 08:47:31 +00:00
|
|
|
|
2019-10-22 13:34:10 +00:00
|
|
|
typedef int (*testQemuCapsIterateCallback)(const char *inputDir,
|
2019-10-22 14:08:10 +00:00
|
|
|
const char *prefix,
|
|
|
|
const char *version,
|
2019-03-07 14:54:55 +00:00
|
|
|
const char *archName,
|
2019-10-22 13:44:37 +00:00
|
|
|
const char *suffix,
|
2019-03-07 14:54:55 +00:00
|
|
|
void *opaque);
|
2019-04-16 10:33:14 +00:00
|
|
|
int testQemuCapsIterate(const char *suffix,
|
2019-03-07 14:54:55 +00:00
|
|
|
testQemuCapsIterateCallback callback,
|
|
|
|
void *opaque);
|
|
|
|
|
2021-08-17 13:30:44 +00:00
|
|
|
void testQemuInfoSetArgs(struct testQemuInfo *info,
|
|
|
|
struct testQemuConf *conf,
|
|
|
|
...);
|
|
|
|
int testQemuInfoInitArgs(struct testQemuInfo *info);
|
2019-03-31 15:49:34 +00:00
|
|
|
void testQemuInfoClear(struct testQemuInfo *info);
|
|
|
|
|
2019-06-18 16:13:14 +00:00
|
|
|
#endif
|