Commit ac1abb5b authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

hotplug: add check for uio_pci_generic driver



Add a check for this driver and enable iova=pa mode when it is
detected.
Add an option for the hotplug application to force iova mode.

This is to avoid:

EAL:   Expecting 'PA' IOVA mode but current mode is 'VA', not initializing
EAL: Requested device 0000:86:00.0 cannot be used

while using hw_hotplug test.

Change-Id: I7ff819c04b1e567b5ef88fc8f551ecec901806c8
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9774


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 1e6449d8
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ static int g_expected_removal_times = -1;
static int g_insert_times;
static int g_removal_times;
static int g_shm_id = -1;
static const char *g_iova_mode = NULL;
static uint64_t g_timeout_in_us = SPDK_SEC_TO_USEC;
static struct spdk_nvme_detach_ctx *g_detach_ctx;

@@ -425,6 +426,7 @@ static void usage(char *program_name)
	printf("\t[-n expected hot insert times]\n");
	printf("\t[-r expected hot removal times]\n");
	printf("\t[-t time in seconds]\n");
	printf("\t[-m iova mode: pa or va (optional)\n");
}

static int
@@ -436,12 +438,17 @@ parse_args(int argc, char **argv)
	/* default value */
	g_time_in_sec = 0;

	while ((op = getopt(argc, argv, "c:i:n:r:t:")) != -1) {
	while ((op = getopt(argc, argv, "c:i:m:n:r:t:")) != -1) {
		if (op == '?') {
			usage(argv[0]);
			return 1;
		}

		if (op == 'm') {
			g_iova_mode = optarg;
			continue;
		}

		val = spdk_strtol(optarg, 10);
		if (val < 0) {
			fprintf(stderr, "Converting a string to integer failed\n");
@@ -508,6 +515,9 @@ int main(int argc, char **argv)
	if (g_shm_id > -1) {
		opts.shm_id = g_shm_id;
	}
	if (g_iova_mode) {
		opts.iova_mode = g_iova_mode;
	}
	if (spdk_env_init(&opts) < 0) {
		fprintf(stderr, "Unable to initialize SPDK env\n");
		return 1;
+6 −1
Original line number Diff line number Diff line
@@ -45,10 +45,15 @@ timing_exit hotplug_hw_cfg

timing_enter hotplug_hw_test

mode=""
if [ "$driver" = "uio_pci_generic" ]; then
	mode="-m pa"
fi

exec {log}> >(tee -a "$testdir/log.txt")
exec >&$log 2>&1

$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 &
$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 $mode &
hotplug_pid=$!

trap 'killprocess $hotplug_pid; exit 1' SIGINT SIGTERM EXIT