Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f7767ca
target/arm: Disable SME if SVE is disabled
pm215 Dec 4, 2023
5689d4b
tests/qemu-iotests/149: Use more inclusive language in this test
huth Nov 22, 2023
5533936
sh4: Coding style: Remove tabs
Xunop Nov 24, 2023
4d98618
tests/qtest: check the return value
Nov 21, 2023
2b8fe81
system/memory: use ldn_he_p/stn_he_p
pstrinkle Nov 16, 2023
560b8e1
target/riscv/kvm: fix shadowing in kvm_riscv_(get|put)_regs_csr
danielhb Nov 23, 2023
d369ad5
tests/avocado: Update yamon-bin-02.22.zip URL
philmd Dec 1, 2023
2e8ed6a
tests/avocado: mark ReplayKernelNormal.test_mips64el_malta as flaky
stsquad Dec 1, 2023
169c4e7
Merge tag 'pull-request-2023-12-04' of https://gitlab.com/thuth/qemu …
stefanhaRH Dec 4, 2023
db5e49e
Merge tag 'pull-target-arm-20231204-1' of https://git.linaro.org/peop…
stefanhaRH Dec 4, 2023
eeaaf96
Merge tag 'misc-fixes-20231204' of https://github.com/philmd/qemu int…
stefanhaRH Dec 4, 2023
80a37b0
hw/ufs: avoid generating the same ID string for different LU devices
mita Dec 4, 2023
d451e32
Merge tag 'pull-ufs-20231205' of https://gitlab.com/jeuk20.kim/qemu i…
stefanhaRH Dec 5, 2023
5746f70
i386/sev: Avoid SEV-ES crash due to missing MSR_EFER_LMA bit
mdroth Dec 6, 2023
9c74490
Update version for v8.2.0-rc3 release
stefanhaRH Dec 5, 2023
f6390f8
block/niova: fix compilation errors and add uuid dependency
Paroscale-Shirisha Sep 12, 2025
532e171
Merge branch 'kitwestneat:master' into block-niova-compile-fix
Paroscale-Shirisha Sep 14, 2025
e6e3658
block/niova: add TCP target support
Paroscale-Shirisha Sep 15, 2025
3f52004
Changed the log prints to Dprint and changed default niova-disk size
Paroscale-Shirisha Nov 5, 2025
8ea875b
Merge pull request #1 from Paroscale-Shirisha/shirisha/niova-tcp
Paroscale-Shirisha Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1.92
8.1.93
2 changes: 1 addition & 1 deletion block/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ block_ss.add(files(
'throttle-groups.c',
'write-threshold.c',
), zstd, zlib, gnutls)

block_ss.add(dependency('uuid'))
system_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
system_ss.add(files('block-ram-registrar.c'))

Expand Down
106 changes: 87 additions & 19 deletions block/niova.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "qemu/osdep.h"

#ifndef HAVE_PMULL64
#define HAVE_PMULL64 0
#endif
#include <stdlib.h>
#include <linux/vfio.h>
#include "qapi/error.h"
Expand All @@ -15,17 +17,24 @@
#include "block/block_int.h"
#include "sysemu/replay.h"
#include "trace.h"

#undef MAX
#include <niova/common.h>
#include <niova/nclient.h>
#include <niova/nclient_private.h>

#define NIOVADEV_DEFAULT_FILE_SIZE 100*((size_t)1 << 30)
#define NIOVADEV_DEFAULT_FILE_SIZE ((size_t)1 << 40) // 1TB
#define NIOVADEV_BLOCK_SIZE 4096
#define NIOVADEV_MAX_XFER_BLKS 1024
#define NIOVADEV_MAX_IOV 512
#define NIOVADEV_REQ_OPTS 0

#define NIOVADEV_DEBUG 0
#if NIOVADEV_DEBUG
#define DPRINTF(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#else
#define DPRINTF(fmt, ...) do {} while (0)
#endif

typedef struct NiovaDevState NiovaDevState;

struct NiovaDevState {
Expand Down Expand Up @@ -55,6 +64,7 @@ struct NiovaDevState {
} stats;
};

#define NIOVA_OPT_TARGET "target"
#define NIOVA_OPT_UUID "uuid"
#define NIOVA_OPT_VDEV "vdev"
#define NIOVA_OPT_QUEUE_DEPTH "queue-depth"
Expand All @@ -64,10 +74,15 @@ static QemuOptsList runtime_opts = {
.head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
.desc = {
{
.name = NIOVA_OPT_UUID,
.name = NIOVA_OPT_TARGET,
.type = QEMU_OPT_STRING,
.help = "UUID",
.help = "Target string (e.g. tcp:uuid:ip:port, unix:..., uuid-only)",
},
{
.name = NIOVA_OPT_UUID,
.type = QEMU_OPT_STRING,
.help = "Legacy target UUID",
},
{
.name = NIOVA_OPT_VDEV,
.type = QEMU_OPT_STRING,
Expand All @@ -89,6 +104,15 @@ static QemuOptsList runtime_opts = {
static void niovadev_parse_filename(const char *filename, QDict *options,
Error **errp)
{

// --- New style: tcp:..., unix:..., uuid:... ---
if (g_str_has_prefix(filename, "tcp:") ||
g_str_has_prefix(filename, "unix:") ||
g_str_has_prefix(filename, "uuid:")) {
qdict_put_str(options, NIOVA_OPT_TARGET, filename);
return;
}

int pref = strlen("niova://");
if (strlen(filename) <= pref || strncmp(filename, "niova://", pref)) {
return;
Expand Down Expand Up @@ -168,11 +192,37 @@ static int niovadev_file_open(BlockDriverState *bs, QDict *options, int flags,
qemu_opts_absorb_qdict(opts, options, &error_abort);

NiovaDevState *s = bs->opaque;

// XXX do these strdups need to be freed?
const char *uuid = qemu_opt_get(opts, NIOVA_OPT_UUID);
if (uuid)
uuid_parse(uuid, s->xopts.npcx_opts.target_uuid);
int rc = 0;
fprintf(stderr, "DEBUG: target=%s uuid=%s\n",
qemu_opt_get(opts, NIOVA_OPT_TARGET),
qemu_opt_get(opts, NIOVA_OPT_UUID));

// --- New-style target parsing ---
const char *target = qemu_opt_get(opts, NIOVA_OPT_TARGET);
const char *uuid = qemu_opt_get(opts, NIOVA_OPT_UUID);
if (target) {
fprintf(stderr, "DEBUG: using target='%s'\n", target);
rc = niova_block_client_parse_target_opt_string(
target, &s->xopts.npcx_opts);
if (rc) {
error_setg(errp, "Failed to parse target string: %s", target);
return rc;
}
} else if (uuid) {
fprintf(stderr, "DEBUG: using legacy uuid='%s'\n", uuid);
// XXX do these strdups need to be freed?
// const char *uuid = qemu_opt_get(opts, NIOVA_OPT_UUID);
//if (uuid)
rc = uuid_parse(uuid, s->xopts.npcx_opts.target_uuid);
if (rc) {
error_setg(errp, "Invalid legacy UUID: %s", uuid);
return rc;
}

} else {
error_setg(errp, "Either target= or uuid= must be provided");
return -EINVAL;
}

const char *vdev = qemu_opt_get(opts, NIOVA_OPT_VDEV);
if (vdev)
Expand All @@ -181,9 +231,15 @@ static int niovadev_file_open(BlockDriverState *bs, QDict *options, int flags,
int qd = qemu_opt_get_number(opts, NIOVA_OPT_QUEUE_DEPTH, 0);
if (qd > 0)
s->xopts.npcx_opts.queue_depth = qd;

fprintf(stderr, "uuid=%s vdev=%s qd=%d\n", uuid, vdev, qd);
int rc = niova_client_setup(s);

fprintf(stderr, "niova: target=%s vdev=%s qd=%d ip=%s port=%d\n",
target ? target : "(legacy-uuid)",
vdev ? vdev : "(none)",
s->xopts.npcx_opts.queue_depth,
s->xopts.npcx_opts.net_target_addr,
s->xopts.npcx_opts.net_target_port);

rc = niova_client_setup(s);
if (rc || !s->client) {
error_setg(errp, "niova_client_setup(): %s", strerror(-rc));
return rc;
Expand Down Expand Up @@ -257,7 +313,7 @@ static coroutine_fn int niovadev_co_rw(bool is_write, BlockDriverState *bs,
.ret = -EINPROGRESS,
};

fprintf(stderr, "niova %s 4k sblk %ld 512 nblk %d niov %d iov[0].len %zu\n", is_write ? "write" : "read", start_blk, nblk,
DPRINTF("niova %s 4k sblk %ld 512 nblk %d niov %d iov[0].len %zu\n", is_write ? "write" : "read", start_blk, nblk,
qiov->niov, qiov->iov[0].iov_len);

int rc;
Expand All @@ -280,11 +336,12 @@ static coroutine_fn int niovadev_co_rw(bool is_write, BlockDriverState *bs,

cb_data.co = qemu_coroutine_self();
AioContext *co_ctx = qemu_coroutine_get_aio_context(cb_data.co);
fprintf(stderr, "yielding, equal ctx? %s\n", co_ctx == cb_data.ctx ? "yes" : "no");
(void)co_ctx;
DPRINTF("yielding, equal ctx? %s\n", co_ctx == cb_data.ctx ? "yes" : "no");
do {
qemu_coroutine_yield();
} while (cb_data.ret == -EINPROGRESS);
fprintf(stderr, "done yielding, ret=%zd\n", cb_data.ret);
DPRINTF("done yielding, ret=%zd\n", cb_data.ret);
s->stats.qd_cur--;

unsigned long expected = 0;
Expand Down Expand Up @@ -378,9 +435,20 @@ static void niovadev_refresh_filename(BlockDriverState *bs)
char uuid_str[UUID_STR_LEN] = {0};

uuid_unparse(s->xopts.npcx_opts.target_uuid, uuid_str);

snprintf(bs->exact_filename, sizeof(bs->exact_filename), "niova://%s#%u",
uuid_str, s->xopts.npcx_opts.queue_depth);

if (s->xopts.npcx_opts.flags & NIOVA_BLOCK_FLAGS_TCP_SOCKET) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"tcp:%s:%s:%u",
uuid_str,
s->xopts.npcx_opts.net_target_addr,
s->xopts.npcx_opts.net_target_port);
} else if (s->xopts.npcx_opts.flags & NIOVA_BLOCK_FLAGS_UNIX_SOCKET) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"unix:%s", uuid_str);
} else {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"uuid:%s", uuid_str);
}
}

static void niovadev_refresh_limits(BlockDriverState *bs, Error **errp)
Expand Down
8 changes: 8 additions & 0 deletions hw/ufs/ufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,17 @@ static bool ufs_bus_check_address(BusState *qbus, DeviceState *qdev,
return true;
}

static char *ufs_bus_get_dev_path(DeviceState *dev)
{
BusState *bus = qdev_get_parent_bus(dev);

return qdev_get_dev_path(bus->parent);
}

static void ufs_bus_class_init(ObjectClass *class, void *data)
{
BusClass *bc = BUS_CLASS(class);
bc->get_dev_path = ufs_bus_get_dev_path;
bc->check_address = ufs_bus_check_address;
}

Expand Down
Loading