* Re: [dpdk-dev] [RFC 00/12] introduce s390x architecture
From: Pradeep Satyanarayana @ 2020-02-20 0:20 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, David Christensen, Vivian Kong, David Wilder
In-Reply-To: <17413425.geO5KgaWL5@xps>
Thomas Monjalon <thomas@monjalon.net> wrote on 02/18/2020 01:03:27 PM:
> From: Thomas Monjalon <thomas@monjalon.net>
> To: Vivian Kong <vivkong@ca.ibm.com>
> Cc: dev@dpdk.org, Pradeep Satyanarayana <pradeep@us.ibm.com>, David
> Christensen <drc@linux.vnet.ibm.com>, David Wilder <wilder@us.ibm.com>
> Date: 02/18/2020 01:03 PM
> Subject: [EXTERNAL] Re: [dpdk-dev] [RFC 00/12] introduce s390x
architecture
>
> Hi,
>
> 09/04/2019 21:06, Vivian Kong:
> > To build and run DPDK on Linux on IBM Z (s390x), big endian support
> > is added and s390x vector intrinics are used in the implementation
> > of DPDK libraries.
>
> What is the status of this work?
> Is it abandoned?
Thomas, Our team is not associated with this effort. Let me reach out to
Vivian and
request her to respond.
Thanks
Pradeep
pradeep@us.ibm.com
^ permalink raw reply
* [PATCH] rtc: zynqmp: Add calibration set and get support
From: Srinivas Neeli @ 2020-02-20 9:31 UTC (permalink / raw)
To: a.zummo, alexandre.belloni, michal.simek, sgoud, shubhraj
Cc: linux-rtc, Srinivas Goud, Srinivas Neeli, linux-kernel, git,
linux-arm-kernel
ZynqMp RTC controller has a calibration feature to compensate
time deviation due to input clock inaccuracy.
Set and get calibration API's are used for setting and getting
calibration value from the controller calibration register.
Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
drivers/rtc/rtc-zynqmp.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 4b1077e2f826..b4118e9e4fcc 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -40,6 +40,12 @@
#define RTC_CALIB_MASK 0x1FFFFF
#define RTC_ALRM_MASK BIT(1)
#define RTC_MSEC 1000
+#define RTC_FR_MASK 0xF0000
+#define RTC_SEC_MAX_VAL 0xFFFFFFFF
+#define RTC_FR_MAX_TICKS 16
+#define RTC_OFFSET_MAX 150000
+#define RTC_OFFSET_MIN -150000
+#define RTC_PPB 1000000000LL
struct xlnx_rtc_dev {
struct rtc_device *rtc;
@@ -184,12 +190,84 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev)
writel(xrtcdev->calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
}
+static int xlnx_rtc_read_offset(struct device *dev, long *offset)
+{
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
+ long offset_val;
+ unsigned int reg;
+ unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
+
+ reg = readl(xrtcdev->reg_base + RTC_CALIB_RD);
+
+ /* Offset with seconds ticks */
+ offset_val = reg & RTC_TICK_MASK;
+ offset_val = offset_val - xrtcdev->calibval;
+ offset_val = offset_val * tick_mult;
+
+ /* Offset with fractional ticks */
+ if (reg & RTC_FR_EN)
+ offset_val += ((reg & RTC_FR_MASK) >> RTC_FR_DATSHIFT)
+ * (tick_mult / RTC_FR_MAX_TICKS);
+ *offset = offset_val;
+
+ return 0;
+}
+
+static int xlnx_rtc_set_offset(struct device *dev, long offset)
+{
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
+ short int max_tick;
+ unsigned char fract_tick = 0;
+ unsigned int calibval;
+ int fract_offset;
+ unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
+
+ /* Make sure offset value is within supported range */
+ if (offset < RTC_OFFSET_MIN || offset > RTC_OFFSET_MAX)
+ return -ERANGE;
+
+ /* Number ticks for given offset */
+ max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
+
+ /* Number fractional ticks for given offset */
+ if (fract_offset) {
+ if (fract_offset < 0) {
+ fract_offset = fract_offset + tick_mult;
+ max_tick--;
+ }
+ if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
+ for (fract_tick = 1; fract_tick < 16; fract_tick++) {
+ if (fract_offset <=
+ (fract_tick *
+ (tick_mult / RTC_FR_MAX_TICKS)))
+ break;
+ }
+ }
+ }
+
+ /* Zynqmp RTC uses second and fractional tick
+ * counters for compensation
+ */
+ calibval = max_tick + xrtcdev->calibval;
+
+ if (fract_tick)
+ calibval |= RTC_FR_EN;
+
+ calibval |= (fract_tick << RTC_FR_DATSHIFT);
+
+ writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
+
+ return 0;
+}
+
static const struct rtc_class_ops xlnx_rtc_ops = {
.set_time = xlnx_rtc_set_time,
.read_time = xlnx_rtc_read_time,
.read_alarm = xlnx_rtc_read_alarm,
.set_alarm = xlnx_rtc_set_alarm,
.alarm_irq_enable = xlnx_rtc_alarm_irq_enable,
+ .read_offset = xlnx_rtc_read_offset,
+ .set_offset = xlnx_rtc_set_offset,
};
static irqreturn_t xlnx_rtc_interrupt(int irq, void *id)
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH v2 1/5] vhost-user block device backend
From: Coiby Xu @ 2020-02-20 9:30 UTC (permalink / raw)
To: Kevin Wolf; +Cc: bharatlkmlkvm, qemu-devel, stefanha
In-Reply-To: <20200116135609.GD9470@linux.fritz.box>
[-- Attachment #1: Type: text/plain, Size: 39721 bytes --]
> > + vmsg->fd_num = 0;
> > + for (cmsg = CMSG_FIRSTHDR(&msg);
> > + cmsg != NULL;
> > + cmsg = CMSG_NXTHDR(&msg, cmsg))
> > + {
> > + if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type ==
SCM_RIGHTS) {
> > + fd_size = cmsg->cmsg_len - CMSG_LEN(0);
> > + vmsg->fd_num = fd_size / sizeof(int);
> > + memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
> > + break;
> > + }
> > + }
> I think the fd passing part becomes easier when you use the proper
> qio_channel_readv_full() function. Its implementation is also a bit more
> careful than yours. For example, you forgot checking fd_size against
> VHOST_MEMORY_MAX_NREGIONS, allowing a buffer overflow in the memcpy(),
> and you don't adjust fd flags for the new file descriptors.
Oh, I used qio_channel_readv_full in v3&v4. But I still forgot checking
fd_size against VHOST_MEMORY_MAX_NREGIONS. I'll fix this buffer overflow
issue in v5.
On Thu, Jan 16, 2020 at 9:56 PM Kevin Wolf <kwolf@redhat.com> wrote:
> Hi,
>
> I'm only doing a quick first review pointing out the more obvious
> things while I familiarise myself with your code. I intend to review it
> in more detail later (either in a second pass for this series, or when
> you post v3).
>
> Am 14.01.2020 um 15:06 hat Coiby Xu geschrieben:
> > By making use of libvhost, multiple block device drives can be exported
> and each drive can serve multiple clients simultaneously. Since
> vhost-user-server needs a block drive to be created first, delay the
> creation of this object.
> >
> > Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
>
> Please wrap the commit message at 72 characters.
>
> > blockdev-vu.c | 1008 ++++++++++++++++++++++++++++++++++++
> > include/block/vhost-user.h | 46 ++
> > vl.c | 4 +
> > 3 files changed, 1058 insertions(+)
> > create mode 100644 blockdev-vu.c
> > create mode 100644 include/block/vhost-user.h
>
> This adds a single, relatively big source file. I see at least two
> parts: The generic vhost-user infrastructure with connection handling
> etc. and the implementation of the specific vhost-user-blk device.
> Separating these into two files is probably a good idea.
>
> I would also suggest to put the files in a new subdirectory
> block/export/ and call them vhost-user.c/vhost-user-blk.c. The new
> header file can be in the same directory as it shouldn't be used by
> anyone else.
>
> > diff --git a/blockdev-vu.c b/blockdev-vu.c
> > new file mode 100644
> > index 0000000000..45f0bb43a7
> > --- /dev/null
> > +++ b/blockdev-vu.c
> > @@ -0,0 +1,1008 @@
>
> The LICENSE file clarifies that files without a license header are
> GPLv2+, so it's not strictly a problem, but I think it is good style to
> include a license header that explicitly tells so.
>
> > +#include "qemu/osdep.h"
> > +#include "block/vhost-user.h"
> > +#include "qapi/error.h"
> > +#include "qapi/qapi-types-sockets.h"
> > +#include "qapi/qapi-commands-block.h"
> > +
> > +#include "sysemu/block-backend.h"
> > +#include "qemu/main-loop.h"
> > +
> > +#include "qemu/units.h"
> > +
> > +#include "block/block.h"
> > +
> > +#include "qom/object_interfaces.h"
> > +
> > +#include <sys/eventfd.h>
> > +
> > +#include "hw/qdev-properties.h"
>
> Does the order of includes and the empty lines between them signify
> anything? If not, I suggest just sorting them alphabetically (and maybe
> using empty lines between different subdirectories if you like this
> better than a single large block).
>
> According to CODING_STYLE.rst, system headers like <sys/eventfd.h> come
> before all QEMU headers (except qemu/osdep.h, which always must come
> first).
>
> > +enum {
> > + VHOST_USER_BLK_MAX_QUEUES = 8,
> > +};
> > +
> > +struct virtio_blk_inhdr {
> > + unsigned char status;
> > +};
> > +
> > +
> > +static QTAILQ_HEAD(, VubDev) vub_devs =
> QTAILQ_HEAD_INITIALIZER(vub_devs);
> > +
> > +
> > +typedef struct VubReq {
> > + VuVirtqElement *elem;
>
> Maybe worth a comment that this was allocated with plain malloc(), so
> you must use free() rather than g_free() (which would be the default in
> QEMU)?
>
> > + int64_t sector_num;
> > + size_t size;
> > + struct virtio_blk_inhdr *in;
> > + struct virtio_blk_outhdr out;
> > + VuClient *client;
> > + struct VuVirtq *vq;
> > +} VubReq;
>
> I'm not completely sure yet, but I think I would prefer VuBlock to Vub
> in the type names. Some may even prefer VhostUserBlock, but I can see
> that this would be quite lengthy.
>
> > +static void
> > +remove_watch(VuDev *vu_dev, int fd)
> > +{
> > + VuClient *client;
> > +
> > + g_assert(vu_dev);
> > + g_assert(fd >= 0);
> > +
> > + client = container_of(vu_dev, VuClient, parent);
> > + aio_set_fd_handler(client->blk->ctx, fd, false, NULL, NULL, NULL,
> NULL);
> > +}
> > +
> > +static void close_client(VuClient *client)
> > +{
> > + vu_deinit(&client->parent);
> > + /** g_source_destroy(vub_device->parent.src); */
>
> Leftover from conversion?
>
> > + client->sioc = NULL;
> > + object_unref(OBJECT(client->ioc));
> > + client->closed = true;
> > +
> > +}
> > +
> > +static void vub_panic_cb(VuDev *vu_dev, const char *buf)
>
> You use a lot of sprintf() before calling this function. Would it be
> worth taking a printf-like format parameter instead of buf and using a
> variable argument list?
>
> > +{
> > + if (buf) {
> > + g_warning("vu_panic: %s", buf);
>
> I think QEMU proper doesn't use g_warning() anywhere. This could be
> error_report() or warn_report(). (Or if you use a format string
> error_vreport() and warn_vreport().)
>
> > + }
> > +
> > + VuClient *client = container_of(vu_dev, VuClient, parent);
> > + if (client->blk->exit_panic) {
> > + client->blk->close = true;
> > + }
> > + if (!client->closed) {
> > + close_client(client);
> > + }
> > +}
> > +
> > +
> > +static void vub_req_complete(VubReq *req)
> > +{
> > + VuDev *vu_dev = &req->client->parent;
> > +
> > + /* IO size with 1 extra status byte */
> > + vu_queue_push(vu_dev, req->vq, req->elem,
> > + req->size + 1);
>
> I think this fits in a single line.
>
> > + vu_queue_notify(vu_dev, req->vq);
> > +
> > + if (req->elem) {
> > + free(req->elem);
> > + }
> > +
> > + g_free(req);
> > +}
> > +
> > +
> > +
> > +static int
> > +vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t
> iovcnt,
> > + uint32_t type)
> > +{
> > + struct virtio_blk_discard_write_zeroes *desc;
> > + ssize_t size;
> > + void *buf;
> > +
> > + size = iov_size(iov, iovcnt);
> > + if (size != sizeof(*desc)) {
> > + fprintf(stderr, "Invalid size %ld, expect %ld\n", size,
> sizeof(*desc));
> > + return -1;
>
> This would be error_report(), too. (More cases below, I'll ignore them
> now.)
>
> I would prefer consistent use of -errno instead of -1 for error cases if
> you don't mind. I guess this would be -EINVAL here. I won't mention it
> for all the other cases; if you want to make the change, you need to
> make it everywhere, obviously.
>
> > + }
> > + buf = g_new0(char, size);
> > +
> > + iov_to_buf_full(iov, iovcnt, 0, buf, size);
>
> I think uint8_t describes better than char what we want here: A buffer
> of bytes.
>
> The empty line would make more sense to me above the g_new0() line than
> after it because it starts a new section that deals with the buffer. In
> general, the use of empty lines feels a bit inconsistent in this patch.
> You may want to go over them again.
>
> > +
> > + #if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
>
> Preprocessor directives should be unindented.
>
> However, I don't think any of this code actually depends on Linux,
> BLKDISCARD or BLKZEROOUT. You can just call blk_pdiscard() and
> blk_pwrite_zeroes() and they will do whatever is necessary to perform
> the operation on the backend (which might not be a Linux block device,
> but could be a regular file or even using a network protocol like NBD).
>
> > + VubDev *vdev_blk;
> > + VuClient *client = container_of(dev, VuClient, parent);
> > + vdev_blk = client->blk;
> > + desc = (struct virtio_blk_discard_write_zeroes *)buf;
> > + uint64_t range[2] = { le64toh(desc->sector) << 9,
> > + le32toh(desc->num_sectors) << 9 };
> > + if (type == VIRTIO_BLK_T_DISCARD) {
> > + if (blk_pdiscard(vdev_blk->blk, range[0], range[1]) == 0) {
> > + g_free(buf);
> > + return 0;
> > + }
> > + } else if (type == VIRTIO_BLK_T_WRITE_ZEROES) {
> > + if (blk_pwrite_zeroes(vdev_blk->blk, range[0], range[1]) == 0) {
> > + g_free(buf);
> > + return 0;
> > + }
>
> blk_pdiscard() and blk_pwrite_zeroes() are synchronous functions. In
> other words, the guest will be blocked until the I/O is complete. We
> cannot do this.
>
> I think you should let vub_virtio_process_req() run in a coroutine so
> that you can call blk_co_pdiscard() and blk_co_pwrite_zeroes() here.
>
> > + }
> > + #endif
> > +
> > + g_free(buf);
> > + return -1;
> > +}
> > +
> > +
> > +static void
> > +vub_flush(VubReq *req)
> > +{
> > + VuClient *client = req->client;
> > + blk_co_flush(client->blk->backend);
>
> You can't call blk_co_flush() from outside coroutine context. This code
> will be right after you move vub_virtio_process_req() to a coroutine,
> though (which will make this function a coroutine_fn).
>
> > +}
> > +
> > +
> > +#define NOT_DONE 0x7fffffff /* used while emulated sync operation in
> progress */
> > +typedef struct BlkRwCo {
> > + BlockBackend *blk;
> > + int64_t offset;
> > + void *iobuf;
> > + int ret;
> > + BdrvRequestFlags flags;
> > +} BlkRwCo;
> > +
> > +static void blk_read_entry(void *opaque)
> > +{
> > + BlkRwCo *rwco = opaque;
> > + QEMUIOVector *qiov = rwco->iobuf;
> > +
> > + rwco->ret = blk_co_preadv(rwco->blk, rwco->offset, qiov->size,
> > + qiov, rwco->flags);
> > + aio_wait_kick();
> > +}
> > +
> > +
> > +static void blk_write_entry(void *opaque)
> > +{
> > + BlkRwCo *rwco = opaque;
> > + QEMUIOVector *qiov = rwco->iobuf;
> > +
> > + rwco->ret = blk_co_pwritev(rwco->blk, rwco->offset, qiov->size,
> > + qiov, rwco->flags);
> > + aio_wait_kick();
> > +}
> > +
> > +
> > +static int blk_prw(BlockBackend *blk, QEMUIOVector *qiov, int64_t
> offset,
> > + CoroutineEntry co_entry, BdrvRequestFlags flags)
> > +{
> > +
> > + BlkRwCo rwco = {
> > + .blk = blk,
> > + .offset = offset,
> > + .iobuf = qiov,
> > + .flags = flags,
> > + .ret = NOT_DONE,
> > + };
> > +
> > + if (qemu_in_coroutine()) {
> > + /* Fast-path if already in coroutine context */
> > + co_entry(&rwco);
> > + } else {
> > + Coroutine *co = qemu_coroutine_create(co_entry, &rwco);
> > + bdrv_coroutine_enter(blk_bs(blk), co);
> > + BDRV_POLL_WHILE(blk_bs(blk), rwco.ret == NOT_DONE);
> > + }
> > +
> > + return rwco.ret;
> > +}
>
> This is copy&paste from block-backend.c. We should certainly not do
> this. I think it will automatically go away when you can use
> blk_co_preadv() and blk_co_pwritev() directly.
>
> Note that the BDRV_POLL_WHILE() means that like above, we would be
> waiting for the request to complete. This would block the guest and
> would also not allow parallel requests, killing the I/O performance of
> our vhost-user export.
>
> > +
> > +static ssize_t
> > +vub_rwv(VubReq *req, struct iovec *iov,
> > + uint32_t iovcnt,
> > + CoroutineEntry co_entry)
>
> I don't understand the line wrapping here. :-)
>
> > +{
> > + VuClient *client = req->client;
> > + ssize_t rc;
> > +
> > + if (!iovcnt) {
> > + fprintf(stderr, "Invalid Read/Write IOV count\n");
> > + return -1;
> > + }
> > +
> > + int64_t offset = req->sector_num * 512;
> > + QEMUIOVector *qiov = g_new0(QEMUIOVector, 1);
> > + qemu_iovec_init_external(qiov, iov, iovcnt);
> > + rc = blk_prw(client->blk->backend, qiov, offset, co_entry, 0);
> > +
> > + req->size = iov_size(iov, iovcnt);
>
> You can use qiov->size instead of duplicating this information into a
> separate VubReq field.
>
> > + if (rc < 0) {
> > + fprintf(stderr, "%s, Sector %"PRIu64", Size %lu failed with
> %s\n",
> > + client->blk->name, req->sector_num, req->size,
> > + strerror(errno));
> > + return -1;
> > + }
> > +
> > + return rc;
> > +}
> > +
> > +static int vub_virtio_process_req(VuClient *client,
> > + VuVirtq *vq)
>
> Indentation is off. This could be a single line anyway.
>
> > +{
> > + VuDev *vu_dev = &client->parent;
> > + VuVirtqElement *elem;
> > + uint32_t type;
> > + VubReq *req;
> > +
> > + elem = vu_queue_pop(vu_dev, vq, sizeof(VuVirtqElement) +
> sizeof(VubReq));
> > + if (!elem) {
> > + return -1;
> > + }
> > +
> > + struct iovec *in_iov = elem->in_sg;
> > + struct iovec *out_iov = elem->out_sg;
> > + unsigned in_num = elem->in_num;
> > + unsigned out_num = elem->out_num;
> > + /* refer to hw/block/virtio_blk.c */
> > + if (elem->out_num < 1 || elem->in_num < 1) {
> > + fprintf(stderr, "virtio-blk request missing headers\n");
> > + free(elem);
> > + return -1;
> > + }
> > +
> > + req = g_new0(VubReq, 1);
> > + req->client = client;
> > + req->vq = vq;
> > + req->elem = elem;
> > +
> > + if (unlikely(iov_to_buf(out_iov, out_num, 0, &req->out,
> > + sizeof(req->out)) != sizeof(req->out))) {
> > + fprintf(stderr, "virtio-blk request outhdr too short");
> > + goto err;
> > + }
> > +
> > + iov_discard_front(&out_iov, &out_num, sizeof(req->out));
> > +
> > + if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) {
> > + fprintf(stderr, "virtio-blk request inhdr too short");
> > + goto err;
> > + }
> > +
> > + /* We always touch the last byte, so just see how big in_iov is. */
> > + req->in = (void *)in_iov[in_num - 1].iov_base
> > + + in_iov[in_num - 1].iov_len
> > + - sizeof(struct virtio_blk_inhdr);
> > + iov_discard_back(in_iov, &in_num, sizeof(struct virtio_blk_inhdr));
> > +
> > +
> > + type = le32toh(req->out.type);
> > + switch (type & ~VIRTIO_BLK_T_BARRIER) {
> > + case VIRTIO_BLK_T_IN:
> > + case VIRTIO_BLK_T_OUT: {
> > + ssize_t ret = 0;
> > + bool is_write = type & VIRTIO_BLK_T_OUT;
> > + req->sector_num = le64toh(req->out.sector);
> > + if (is_write) {
> > + ret = vub_rwv(req, out_iov, out_num, blk_write_entry);
> > + } else {
> > + ret = vub_rwv(req, in_iov, in_num, blk_read_entry);
> > + }
> > + if (ret >= 0) {
> > + req->in->status = VIRTIO_BLK_S_OK;
> > + } else {
> > + req->in->status = VIRTIO_BLK_S_IOERR;
> > + }
> > + vub_req_complete(req);
> > + break;
> > + }
> > + case VIRTIO_BLK_T_FLUSH:
> > + vub_flush(req);
> > + req->in->status = VIRTIO_BLK_S_OK;
> > + vub_req_complete(req);
> > + break;
> > + case VIRTIO_BLK_T_GET_ID: {
> > + size_t size = MIN(iov_size(&elem->in_sg[0], in_num),
> > + VIRTIO_BLK_ID_BYTES);
> > + snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
> > + req->in->status = VIRTIO_BLK_S_OK;
> > + req->size = elem->in_sg[0].iov_len;
> > + vub_req_complete(req);
> > + break;
> > + }
> > + case VIRTIO_BLK_T_DISCARD:
> > + case VIRTIO_BLK_T_WRITE_ZEROES: {
> > + int rc;
> > + rc = vub_discard_write_zeroes(req, &elem->out_sg[1], out_num,
> type);
> > + if (rc == 0) {
> > + req->in->status = VIRTIO_BLK_S_OK;
> > + } else {
> > + req->in->status = VIRTIO_BLK_S_IOERR;
> > + }
> > + vub_req_complete(req);
> > + break;
> > + }
> > + default:
> > + req->in->status = VIRTIO_BLK_S_UNSUPP;
> > + vub_req_complete(req);
> > + break;
> > + }
> > +
> > + return 0;
> > +
> > +err:
> > + free(elem);
> > + g_free(req);
> > + return -1;
> > +}
> > +
> > +
> > +static void vub_process_vq(VuDev *vu_dev, int idx)
> > +{
> > + VuClient *client;
> > + VuVirtq *vq;
> > + int ret;
> > +
> > + client = container_of(vu_dev, VuClient, parent);
> > + assert(client);
> > +
> > + vq = vu_get_queue(vu_dev, idx);
> > + assert(vq);
> > +
> > + while (1) {
> > + ret = vub_virtio_process_req(client, vq);
> > + if (ret) {
> > + break;
> > + }
> > + }
> > +}
>
> I mentioned above moving vub_virtio_process_req() into a coroutine. Just
> creating a coroutine here and entering it wouldn't work, though.
>
> The best design is probably to get requests from the virtqueue in this
> function (what is currently the first half of vub_virtio_process_req())
> and then spawn a coroutine per request to actually execute them (roughly
> the switch in vub_virtio_process_req()).
>
> This way you'll get parallel requests and won't have to think about
> synchronising accesses to the virtqueue from multiple coroutines.
>
> > +
> > +static void vub_queue_set_started(VuDev *vu_dev, int idx, bool started)
> > +{
> > + VuVirtq *vq;
> > +
> > + assert(vu_dev);
> > +
> > + vq = vu_get_queue(vu_dev, idx);
> > + vu_set_queue_handler(vu_dev, vq, started ? vub_process_vq : NULL);
> > +}
> > +
> > +static uint64_t
> > +vub_get_features(VuDev *dev)
> > +{
> > + uint64_t features;
> > + VubDev *vdev_blk;
> > +
> > + VuClient *client = container_of(dev, VuClient, parent);
> > + vdev_blk = client->blk;
> > +
> > + features = 1ull << VIRTIO_BLK_F_SIZE_MAX |
> > + 1ull << VIRTIO_BLK_F_SEG_MAX |
> > + 1ull << VIRTIO_BLK_F_TOPOLOGY |
> > + 1ull << VIRTIO_BLK_F_BLK_SIZE |
> > + 1ull << VIRTIO_BLK_F_FLUSH |
> > + #if defined(__linux__) && defined(BLKDISCARD) &&
> defined(BLKZEROOUT)
> > + 1ull << VIRTIO_BLK_F_DISCARD |
> > + 1ull << VIRTIO_BLK_F_WRITE_ZEROES |
> > + #endif
> > + 1ull << VIRTIO_BLK_F_CONFIG_WCE |
> > + 1ull << VIRTIO_F_VERSION_1 |
> > + 1ull << VIRTIO_RING_F_INDIRECT_DESC |
> > + 1ull << VIRTIO_RING_F_EVENT_IDX |
> > + 1ull << VHOST_USER_F_PROTOCOL_FEATURES;
> > +
> > + if (!vdev_blk->writable) {
> > + features |= 1ull << VIRTIO_BLK_F_RO;
> > + }
> > +
> > + return features;
> > +}
> > +
> > +static uint64_t
> > +vub_get_protocol_features(VuDev *dev)
> > +{
> > + return 1ull << VHOST_USER_PROTOCOL_F_CONFIG |
> > + 1ull << VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD;
> > +}
> > +
> > +static int
> > +vub_get_config(VuDev *vu_dev, uint8_t *config, uint32_t len)
> > +{
> > + VubDev *vdev_blk;
> > +
> > + VuClient *client = container_of(vu_dev, VuClient, parent);
> > + vdev_blk = client->blk;
> > + memcpy(config, &vdev_blk->blkcfg, len);
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +vub_set_config(VuDev *vu_dev, const uint8_t *data,
> > + uint32_t offset, uint32_t size, uint32_t flags)
> > +{
> > + VubDev *vdev_blk;
> > +
> > + VuClient *client = container_of(vu_dev, VuClient, parent);
> > + vdev_blk = client->blk;
> > + uint8_t wce;
> > +
> > + /* don't support live migration */
> > + if (flags != VHOST_SET_CONFIG_TYPE_MASTER) {
> > + return -1;
> > + }
> > +
> > +
> > + if (offset != offsetof(struct virtio_blk_config, wce) ||
> > + size != 1) {
> > + return -1;
> > + }
> > +
> > + wce = *data;
> > + if (wce == vdev_blk->blkcfg.wce) {
> > + /* Do nothing as same with old configuration */
> > + return 0;
> > + }
> > +
> > + vdev_blk->blkcfg.wce = wce;
> > + blk_set_enable_write_cache(vdev_blk->backend, true);
> > + return 0;
> > +}
> > +
> > +
> > +/*
> > + * When the client disconnects, it send a VHOST_USER_NONE request
>
> s/send/sends/
>
> > + * and vu_process_message will simple call exit which cause the VM
> > + * to exit abruptly.
> > + * To avoid this issue, process VHOST_USER_NONE request ahead
> > + * of vu_process_message.
> > + *
> > + */
> > +static int vub_process_msg(VuDev *dev, VhostUserMsg *vmsg, int
> *do_reply)
> > +{
> > + if (vmsg->request == VHOST_USER_NONE) {
> > + dev->panic(dev, "disconnect");
> > + return true;
> > + }
> > + return false;
> > +}
> > +
> > +static void
> > +vmsg_close_fds(VhostUserMsg *vmsg)
> > +{
> > + int i;
> > + for (i = 0; i < vmsg->fd_num; i++) {
> > + close(vmsg->fds[i]);
> > + }
> > +}
> > +
> > +static bool
> > +vu_message_read_co(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg)
> > +{
> > + char control[CMSG_SPACE(VHOST_MEMORY_MAX_NREGIONS * sizeof(int))] =
> { };
> > + struct iovec iov = {
> > + .iov_base = (char *)vmsg,
> > + .iov_len = VHOST_USER_HDR_SIZE,
> > + };
> > + struct msghdr msg = {
> > + .msg_iov = &iov,
> > + .msg_iovlen = 1,
> > + .msg_control = control,
> > + .msg_controllen = sizeof(control),
> > + };
> > + size_t fd_size;
> > + struct cmsghdr *cmsg;
> > + int rc;
> > + char buffer[100];
> > + VuClient *client = container_of(vu_dev, VuClient, parent);
> > + QIOChannel *ioc = client->ioc;
> > + do {
> > + rc = recvmsg(conn_fd, &msg, 0);
>
> This should certainly use qio_channel_readv_full() rather than working
> directly with a socket fd?
>
> > + if (rc < 0) {
> > + if (errno == EAGAIN) {
> > + if (qemu_in_coroutine()) {
> > + qio_channel_yield(ioc, G_IO_IN);
> > + } else {
> > + qio_channel_wait(ioc, G_IO_IN);
> > + }
> > + continue;
> > + } else if (errno == EINTR) {
> > + continue;
> > + }
> > + }
> > + break;
> > + } while (true);
> > +
> > + if (rc < 0) {
> > + sprintf(buffer, "Error while recvmsg: %s", strerror(errno));
> > + vub_panic_cb(vu_dev, buffer);
> > + return false;
> > + }
> > +
> > + assert(rc == VHOST_USER_HDR_SIZE || rc == 0);
>
> Why do you think that there can't be short reads?
>
> > + vmsg->fd_num = 0;
> > + for (cmsg = CMSG_FIRSTHDR(&msg);
> > + cmsg != NULL;
> > + cmsg = CMSG_NXTHDR(&msg, cmsg))
> > + {
> > + if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type ==
> SCM_RIGHTS) {
> > + fd_size = cmsg->cmsg_len - CMSG_LEN(0);
> > + vmsg->fd_num = fd_size / sizeof(int);
> > + memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
> > + break;
> > + }
> > + }
>
> I think the fd passing part becomes easier when you use the proper
> qio_channel_readv_full() function. Its implementation is also a bit more
> careful than yours. For example, you forgot checking fd_size against
> VHOST_MEMORY_MAX_NREGIONS, allowing a buffer overflow in the memcpy(),
> and you don't adjust fd flags for the new file descriptors.
>
> > + if (vmsg->size > sizeof(vmsg->payload)) {
> > + sprintf(buffer,
> > + "Error: too big message request: %d, size: vmsg->size:
> %u, "
> > + "while sizeof(vmsg->payload) = %zu\n",
> > + vmsg->request, vmsg->size, sizeof(vmsg->payload));
> > + vub_panic_cb(vu_dev, buffer);
> > + goto fail;
> > + }
> > +
> > + if (vmsg->size) {
> > + do {
> > + rc = read(conn_fd, &vmsg->payload, vmsg->size);
>
> qio_channel_readv_all_eof() already implements this whole loop and
> correctly handles short reads, too.
>
> > + if (rc < 0) {
> > + if (errno == EAGAIN) {
> > + if (qemu_in_coroutine()) {
> > + qio_channel_yield(ioc, G_IO_IN);
> > + } else {
> > + qio_channel_wait(ioc, G_IO_IN);
> > + }
> > + continue;
> > + } else if (errno == EINTR) {
> > + continue;
> > + }
> > + }
> > + break;
> > + } while (true);
> > +
> > + if (rc <= 0) {
> > + sprintf(buffer, "Error while reading: %s", strerror(errno));
> > + vub_panic_cb(vu_dev, buffer);
> > + goto fail;
> > + }
> > +
> > + assert(rc == vmsg->size);
> > + }
> > +
> > + return true;
> > +
> > +fail:
> > + vmsg_close_fds(vmsg);
> > +
> > + return false;
> > +}
> > +
> > +static void vub_kick_cb(void *opaque)
> > +{
> > + vu_watch_cb_data *data = (vu_watch_cb_data *) opaque;
> > + int index = data->index;
> > + VuDev *dev = data->vu_dev;
> > + VuVirtq *vq = &dev->vq[index];
> > + int sock = vq->kick_fd;
> > + eventfd_t kick_data;
> > + ssize_t rc;
> > +
> > + rc = eventfd_read(sock, &kick_data);
> > + if (rc == -1) {
> > + char buffer[100];
> > + sprintf(buffer, "kick eventfd_read(): %s", strerror(errno));
> > + vub_panic_cb(dev, buffer);
> > + g_free(data);
> > + dev->remove_watch(dev, dev->vq[index].kick_fd);
> > + } else {
> > + if (vq->handler) {
> > + vq->handler(dev, index);
> > + }
> > + }
> > +}
> > +
> > +static const VuDevIface vub_iface = {
> > + .get_features = vub_get_features,
> > + .queue_set_started = vub_queue_set_started,
> > + .get_protocol_features = vub_get_protocol_features,
> > + .get_config = vub_get_config,
> > + .set_config = vub_set_config,
> > + .process_msg = vub_process_msg,
> > + .read_msg = vu_message_read_co,
> > + .kick_callback = vub_kick_cb,
> > +};
>
> I would prefer the = signs to be aligned to the same column.
>
> > +
> > +void vub_free(VubDev *vub_dev, bool called_by_QOM)
> > +{
> > + if (!vub_dev) {
> > + return;
> > + }
> > +
> > + blk_unref(vub_dev->backend);
> > + g_free(vub_dev->name);
> > + g_free(vub_dev->unix_socket);
> > +
> > + if (vub_dev->next.tqe_circ.tql_prev) {
> > + /*
> > + * if vub_dev->next.tqe_circ.tql_prev = null,
> > + * vub_dev hasn't been inserted into the queue and
> > + * vub_free is called by obj->instance_finalize.
> > + */
> > + QTAILQ_REMOVE(&vub_devs, vub_dev, next);
> > + }
> > + /*
> > + * Needn't to free vub_dev if called by QOM
> > + * because QOM will do the clean-up work.
> > + */
> > + if (!called_by_QOM) {
> > + g_free(vub_dev);
> > + }
> > +}
> > +
> > +static coroutine_fn void vu_client_trip(void *opaque)
> > +{
> > + VuClient *client = opaque;
> > +
> > + while (!client->closed) {
> > + vu_dispatch(&client->parent);
> > + }
> > +
> > + QTAILQ_REMOVE(&client->blk->clients, client, next);
> > +
>
> Extra empty line.
>
> > +}
> > +
> > +static void vu_client_start(VuClient *client)
> > +{
> > + Coroutine *co = qemu_coroutine_create(vu_client_trip, client);
> > + qemu_coroutine_enter(co);
> > +}
> > +
> > +
> > +G_STATIC_ASSERT((int)G_IO_IN == (int)VU_WATCH_IN);
> > +G_STATIC_ASSERT((int)G_IO_OUT == (int)VU_WATCH_OUT);
> > +G_STATIC_ASSERT((int)G_IO_PRI == (int)VU_WATCH_PRI);
> > +G_STATIC_ASSERT((int)G_IO_ERR == (int)VU_WATCH_ERR);
> > +G_STATIC_ASSERT((int)G_IO_HUP == (int)VU_WATCH_HUP);
> > +
> > +static void
> > +set_watch(VuDev *vu_dev, int fd, int vu_evt,
> > + vu_watch_cb_packed_data cb, void *pvt)
> > +{
> > + /*
> > + * since aio_dispatch can only pass one user data pointer to the
> > + * callback function, pack VuDev, pvt into a struct
> > + */
> > + VuClient *client;
> > +
> > + g_assert(vu_dev);
> > + g_assert(fd >= 0);
> > + g_assert(cb);
> > + client = container_of(vu_dev, VuClient, parent);
> > + vu_watch_cb_data *cb_data = g_new0(vu_watch_cb_data, 1);
> > + cb_data->index = (intptr_t) pvt;
> > + cb_data->vu_dev = vu_dev;
> > + aio_set_fd_handler(client->blk->ctx, fd, false, (void *) cb,
> > + NULL, NULL, cb_data);
> > +}
> > +
> > +
> > +void vub_accept(QIONetListener *listener, QIOChannelSocket *sioc,
> > + gpointer opaque)
> > +{
> > + VuClient *client;
> > + VubDev *vub_device = opaque;
> > + client = g_new0(VuClient, 1);
> > +
> > + if (!vu_init_packed_data(&client->parent, VHOST_USER_BLK_MAX_QUEUES,
> > + sioc->fd, vub_panic_cb, set_watch,
> > + remove_watch, &vub_iface)) {
> > + fprintf(stderr, "Failed to initialized libvhost-user\n");
> > + g_free(client);
> > + return;
> > + }
> > +
> > + client->blk = vub_device;
> > + client->refcount = 1;
> > + client->sioc = sioc;
> > + /*
> > + * increase the object reference, so cioc will not freed by
> > + * qio_net_listener_channel_func which will call
> object_unref(OBJECT(sioc))
> > + */
> > + object_ref(OBJECT(client->sioc));
> > + qio_channel_set_name(QIO_CHANNEL(sioc), "vhost-user client");
> > + client->ioc = QIO_CHANNEL(sioc);
> > + object_ref(OBJECT(client->ioc));
> > + object_ref(OBJECT(sioc));
> > +
> > + qio_channel_set_blocking(QIO_CHANNEL(client->sioc), false, NULL);
> > + client->closed = false;
> > + QTAILQ_INSERT_TAIL(&client->blk->clients, client, next);
> > + vu_client_start(client);
> > +}
> > +
> > +
> > +void
> > +vub_initialize_config(BlockDriverState *bs, struct virtio_blk_config
> *config)
> > +{
> > + config->capacity = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
> > + config->blk_size = BDRV_SECTOR_SIZE;
> > + config->size_max = 65536;
> > + config->seg_max = 128 - 2;
> > + config->min_io_size = 1;
> > + config->opt_io_size = 1;
> > + config->num_queues = 1;
> > + #if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
> > + config->max_discard_sectors = 32768;
> > + config->max_discard_seg = 1;
> > + config->discard_sector_alignment = config->blk_size >> 9;
> > + config->max_write_zeroes_sectors = 32768;
> > + config->max_write_zeroes_seg = 1;
> > + #endif
> > +}
> > +
> > +
> > +static VubDev *vub_new(VubDev *vub_device, const char *name,
> > + const char *unix_socket, bool writable, Error
> **errp)
> > +{
> > +
> > + BlockBackend *blk;
> > +
> > + /*
> > + * Don't allow resize while the vhost user server is running,
> > + * otherwise we don't care what happens with the node.
> > + */
> > + uint64_t perm = BLK_PERM_CONSISTENT_READ;
> > + int ret;
> > +
> > + AioContext *ctx;
> > +
> > + BlockDriverState *bs = bdrv_lookup_bs(name,
> > + name,
> > + errp);
>
> This fits in a single line.
>
> > +
> > + if (!bs) {
> > + error_setg(errp,
> > + "No drive with name '%s'."
> > + " Please find the list of names with "
> > + "'info block'", name);
>
> This can probably be two lines instead of four.
>
> > + return NULL;
> > + }
> > +
> > + if (bdrv_is_read_only(bs)) {
> > + writable = false;
> > + }
> > +
> > + if (writable) {
> > + perm |= BLK_PERM_WRITE;
> > + }
> > +
> > + ctx = bdrv_get_aio_context(bs);
> > + aio_context_acquire(ctx);
> > + bdrv_invalidate_cache(bs, NULL);
> > + aio_context_release(ctx);
> > +
> > + blk = blk_new(bdrv_get_aio_context(bs), perm,
> > + BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
> > + BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD);
> > + ret = blk_insert_bs(blk, bs, errp);
> > +
> > + if (ret < 0) {
> > + goto fail;
> > + }
> > +
> > +
> > + blk_set_enable_write_cache(blk, false);
> > +
> > + blk_set_allow_aio_context_change(blk, true);
> > +
> > +
> > + vub_device->name = g_strdup(name);
> > + vub_device->unix_socket = g_strdup(unix_socket);
> > + vub_device->writable = writable;
> > + vub_device->blkcfg.wce = 0;
> > + vub_device->backend = blk;
> > + vub_device->ctx = ctx;
> > + vub_initialize_config(bs, &vub_device->blkcfg);
> > + return vub_device;
> > +
> > +fail:
> > + blk_unref(blk);
> > + return NULL;
> > +}
> > +
> > +void vhost_user_server_free(VubDev *vub_device, bool called_by_QOM)
> > +{
> > + if (!vub_device) {
> > + return;
> > + }
> > +
> > + VuClient *client, *next;
> > + QTAILQ_FOREACH_SAFE(client, &vub_device->clients, next, next) {
> > + if (!client->closed) {
> > + close_client(client);
> > + }
> > + }
> > +
> > + if (vub_device->listener) {
> > + qio_net_listener_disconnect(vub_device->listener);
> > + object_unref(OBJECT(vub_device->listener));
> > + }
> > + vub_free(vub_device, called_by_QOM);
> > +
> > +}
> > +
> > +
> > +VubDev *vub_dev_find(const char *name)
> > +{
> > + VubDev *vub_device;
> > + QTAILQ_FOREACH(vub_device, &vub_devs, next) {
> > + if (strcmp(name, vub_device->name) == 0) {
> > + return vub_device;
> > + }
> > + }
> > +
> > + return NULL;
> > +}
> > +
> > +
> > +static VubDev *vub_dev_find_by_unix_socket(const char *unix_socket)
> > +{
> > + VubDev *vub_device;
> > + QTAILQ_FOREACH(vub_device, &vub_devs, next) {
> > + if (strcmp(unix_socket, vub_device->unix_socket) == 0) {
> > + return vub_device;
> > + }
> > + }
> > +
> > + return NULL;
> > +}
> > +
> > +static void vhost_user_server_start(VubDev *vub_device, const char
> *unix_socket,
> > + const char *name, bool writable,
> > + Error **errp)
> > +{
> > +
> > + if (vub_dev_find(name) || vub_dev_find_by_unix_socket(unix_socket))
> {
> > + error_setg(errp, "Vhost user server with name '%s' or "
> > + "with socket_path '%s' has already been started",
> > + name, unix_socket);
> > + return;
> > + }
> > +
> > +
> > + if (!vub_new(vub_device, name, unix_socket, writable, errp)) {
> > + return;
> > + }
> > +
> > +
> > + vub_device->listener = qio_net_listener_new();
> > +
> > + qio_net_listener_set_name(vub_device->listener,
> > + "vhost-user-backend-listener");
> > +
> > + SocketAddress *addr = g_new0(SocketAddress, 1);
> > + addr->u.q_unix.path = (char *) unix_socket;
> > + addr->type = SOCKET_ADDRESS_TYPE_UNIX;
> > + if (qio_net_listener_open_sync(vub_device->listener, addr, 1, errp)
> < 0) {
> > + goto error;
> > + }
> > +
> > +
> > + QTAILQ_INSERT_TAIL(&vub_devs, vub_device, next);
> > + QTAILQ_INIT(&vub_device->clients);
> > +
> > + qio_net_listener_set_client_func(vub_device->listener,
> > + vub_accept,
> > + vub_device,
> > + NULL);
> > +
> > + return;
> > +
> > + error:
> > + vub_free(vub_device, false);
> > +}
> > +
> > +static void vu_set_block_name(Object *obj, const char *value,
> > + Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);;
> > +
> > + if (vus->name) {
> > + error_setg(errp, "evdev property already set");
> > + return;
> > + }
> > +
> > + vus->name = g_strdup(value);
> > +}
> > +
> > +static char *vu_get_block_name(Object *obj, Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);
> > + return g_strdup(vus->name);
> > +}
> > +
> > +
> > +static void vu_set_unix_socket(Object *obj, const char *value,
> > + Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);;
> > +
> > + if (vus->unix_socket) {
> > + error_setg(errp, "unix_socket property already set");
> > + return;
> > + }
> > +
> > + vus->unix_socket = g_strdup(value);
> > + vhost_user_server_start(vus, value, vus->name,
> > + vus->writable, errp);
> > +}
>
> This makes the unix-socket property magic in that it starts the server
> with the properties specified at this point. This means that this
> property must always be specified last.
>
> Maybe it would be better to use a boolean property (similar to qdev's
> "realized") that explicitly start and possibly stops the export.
>
> Writing to other properties should probably result in an error while the
> server is already running because these property changes won't take
> effect any more then.
>
> > +static char *vu_get_unix_socket(Object *obj, Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);;
> > + return g_strdup(vus->unix_socket);
> > +}
> > +
> > +static bool vu_get_block_writable(Object *obj, Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);;
> > + return vus->writable;
> > +}
> > +
> > +static void vu_set_block_writable(Object *obj, bool value, Error **errp)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);
> > +
> > + vus->writable = value;
> > +}
> > +
> > +static void vhost_user_server_instance_init(Object *obj)
> > +{
> > +
> > + object_property_add_bool(obj, "writable",
> > + vu_get_block_writable,
> > + vu_set_block_writable, NULL);
> > +
> > + object_property_add_str(obj, "name",
> > + vu_get_block_name,
> > + vu_set_block_name, NULL);
> > +
> > + object_property_add_str(obj, "unix_socket",
> > + vu_get_unix_socket,
> > + vu_set_unix_socket, NULL);
>
> These should probably be object_class_property_add_*() and be called in
> .class_init rather than .instance_init.
>
> "name" suggests that it's the name of the export rather than the block
> device to be exported. I would suggest "node-name" (and then actually
> only pass it as node-name to bdrv_lookup_bs()).
>
> I expect that in the long run, we'll want to accept a full SocketAddress
> rather than just a filename like in "unix_socket".
>
> > +}
> > +
> > +static void vhost_user_server_instance_finalize(Object *obj)
> > +{
> > + VubDev *vus = VHOST_USER_SERVER(obj);
> > + vhost_user_server_free(vus, true);
> > + /* object_del shouldn't free this object struct */
> > + obj->free = NULL;
> > +}
> > +
> > +static const TypeInfo vhost_user_server_info = {
> > + .name = TYPE_VHOST_USER_SERVER,
> > + .parent = TYPE_OBJECT,
> > + .instance_size = sizeof(VuDev),
> > + .instance_init = vhost_user_server_instance_init,
> > + .instance_finalize = vhost_user_server_instance_finalize,
> > + .interfaces = (InterfaceInfo[]) {
> > + {TYPE_USER_CREATABLE},
> > + {}
> > + },
> > +};
> > +
> > +static void vhost_user_server_register_types(void)
> > +{
> > + type_register_static(&vhost_user_server_info);
> > +}
> > +
> > +type_init(vhost_user_server_register_types)
> > +
>
> Extra empty line at the file end.
>
> In summary, I can see this going in the right direction, though in
> detail some more work will be needed.
>
> Kevin
>
>
--
*Best regards,*
*Coiby*
[-- Attachment #2: Type: text/html, Size: 51243 bytes --]
^ permalink raw reply
* [PATCH] rtc: zynqmp: Add calibration set and get support
From: Srinivas Neeli @ 2020-02-20 9:31 UTC (permalink / raw)
To: a.zummo, alexandre.belloni, michal.simek, sgoud, shubhraj
Cc: linux-rtc, linux-arm-kernel, linux-kernel, git, Srinivas Neeli,
Srinivas Goud
ZynqMp RTC controller has a calibration feature to compensate
time deviation due to input clock inaccuracy.
Set and get calibration API's are used for setting and getting
calibration value from the controller calibration register.
Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
drivers/rtc/rtc-zynqmp.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 4b1077e2f826..b4118e9e4fcc 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -40,6 +40,12 @@
#define RTC_CALIB_MASK 0x1FFFFF
#define RTC_ALRM_MASK BIT(1)
#define RTC_MSEC 1000
+#define RTC_FR_MASK 0xF0000
+#define RTC_SEC_MAX_VAL 0xFFFFFFFF
+#define RTC_FR_MAX_TICKS 16
+#define RTC_OFFSET_MAX 150000
+#define RTC_OFFSET_MIN -150000
+#define RTC_PPB 1000000000LL
struct xlnx_rtc_dev {
struct rtc_device *rtc;
@@ -184,12 +190,84 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev)
writel(xrtcdev->calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
}
+static int xlnx_rtc_read_offset(struct device *dev, long *offset)
+{
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
+ long offset_val;
+ unsigned int reg;
+ unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
+
+ reg = readl(xrtcdev->reg_base + RTC_CALIB_RD);
+
+ /* Offset with seconds ticks */
+ offset_val = reg & RTC_TICK_MASK;
+ offset_val = offset_val - xrtcdev->calibval;
+ offset_val = offset_val * tick_mult;
+
+ /* Offset with fractional ticks */
+ if (reg & RTC_FR_EN)
+ offset_val += ((reg & RTC_FR_MASK) >> RTC_FR_DATSHIFT)
+ * (tick_mult / RTC_FR_MAX_TICKS);
+ *offset = offset_val;
+
+ return 0;
+}
+
+static int xlnx_rtc_set_offset(struct device *dev, long offset)
+{
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
+ short int max_tick;
+ unsigned char fract_tick = 0;
+ unsigned int calibval;
+ int fract_offset;
+ unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
+
+ /* Make sure offset value is within supported range */
+ if (offset < RTC_OFFSET_MIN || offset > RTC_OFFSET_MAX)
+ return -ERANGE;
+
+ /* Number ticks for given offset */
+ max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
+
+ /* Number fractional ticks for given offset */
+ if (fract_offset) {
+ if (fract_offset < 0) {
+ fract_offset = fract_offset + tick_mult;
+ max_tick--;
+ }
+ if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
+ for (fract_tick = 1; fract_tick < 16; fract_tick++) {
+ if (fract_offset <=
+ (fract_tick *
+ (tick_mult / RTC_FR_MAX_TICKS)))
+ break;
+ }
+ }
+ }
+
+ /* Zynqmp RTC uses second and fractional tick
+ * counters for compensation
+ */
+ calibval = max_tick + xrtcdev->calibval;
+
+ if (fract_tick)
+ calibval |= RTC_FR_EN;
+
+ calibval |= (fract_tick << RTC_FR_DATSHIFT);
+
+ writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
+
+ return 0;
+}
+
static const struct rtc_class_ops xlnx_rtc_ops = {
.set_time = xlnx_rtc_set_time,
.read_time = xlnx_rtc_read_time,
.read_alarm = xlnx_rtc_read_alarm,
.set_alarm = xlnx_rtc_set_alarm,
.alarm_irq_enable = xlnx_rtc_alarm_irq_enable,
+ .read_offset = xlnx_rtc_read_offset,
+ .set_offset = xlnx_rtc_set_offset,
};
static irqreturn_t xlnx_rtc_interrupt(int irq, void *id)
--
2.7.4
^ permalink raw reply related
* [Buildroot] [PATCH 1/1] package/meson: fix pkg-config --static
From: Fabrice Fontaine @ 2020-02-20 9:31 UTC (permalink / raw)
To: buildroot
In-Reply-To: <b355bbc2-43a2-7ad4-3767-5b44393a8fab@mind.be>
Le jeu. 20 f?vr. 2020 ? 10:29, Arnout Vandecappelle <arnout@mind.be> a ?crit :
>
>
>
> On 15/02/2020 16:26, Fabrice Fontaine wrote:
> > pkg-config wrapper is not used since commit
> > 4e0bc29993376613d200e892d491e31ea5a49622, this raise static build
> > failures with libglib2 because --static is not passed anymore to
> > pkg-config so add a patch to get back the old behaviour.
> >
> > Fixes:
> > - http://autobuild.buildroot.org/results/0d36952def63cb69628697fa6408aeb6ce10cb5b
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> > ...dencies-base.py-add-pkg_config_stati.patch | 38 +++++++++++++++++++
> > package/meson/cross-compilation.conf.in | 1 +
> > package/pkg-meson.mk | 1 +
> > 3 files changed, 40 insertions(+)
> > create mode 100644 package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> >
> > diff --git a/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch b/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> > new file mode 100644
> > index 0000000000..7bb00f3fba
> > --- /dev/null
> > +++ b/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> > @@ -0,0 +1,38 @@
> > +From 3a4962ede0d12bac66b38e0843f6e2ea75b03d50 Mon Sep 17 00:00:00 2001
> > +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +Date: Sat, 15 Feb 2020 15:13:59 +0100
> > +Subject: [PATCH] mesonbuild/dependencies/base.py: add pkg_config_static
> > +
> > +Allow the user to always call pkg-config with --static thanks to a
> > +pkg_config_static property. This will allow to fix static build failures
> > +with libglib2:
> > +
> > +FAILED: gio/gio
> > +/home/naourr/work/instance-0/output-1/host/bin/arm-linux-gcc -o gio/gio 'gio/6ae6c9e@@gio at exe/gio-tool.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-cat.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-copy.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-info.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-list.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mime.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mkdir.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-monitor.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mount.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-move.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-open.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-rename.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-remove.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-save.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-set.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-trash.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-tree.c.o' -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -static -Wl,--start-group gio/libgio-2.0.a glib/libglib-2.0.a gobject/libgobject-2.0.a gmodule/libgmodule-2.0.a -pthread /home/naourr/work/instance-0/output-1/host/arm-build
> > root-linux-uclibcgnueabi/sysroot/usr/lib/libz.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpcre.a -lm /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libffi.a -Wl,--end-group '-Wl,-rpath,$ORIGIN/:$ORIGIN/../glib:$ORIGIN/../gobject:$ORIGIN/../gmodule' -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gio -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/glib -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gobject -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gmodule
> > +/home/naourr/work/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a(la-fs.o): in function `__mnt_fs_set_source_ptr':
> > +fs.c:(.text+0x5ec): undefined reference to `blkid_parse_tag_string'
> > +
> > +Fixes:
> > + - http://autobuild.buildroot.org/results/0d36952def63cb69628697fa6408aeb6ce10cb5b
> > +
> > +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +---
> > + mesonbuild/dependencies/base.py | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
> > +index a83e3d6c..913bff6b 100644
> > +--- a/mesonbuild/dependencies/base.py
> > ++++ b/mesonbuild/dependencies/base.py
> > +@@ -840,7 +840,7 @@ class PkgConfigDependency(ExternalDependency):
> > + def _set_libs(self):
> > + env = None
> > + libcmd = [self.name, '--libs']
> > +- if self.static:
> > ++ if self.static or self.env.properties[self.for_machine].get('pkg_config_static', False):
>
> Looks OK-ish to me, *if* we can get it accepted upstream. As is, it probably
> won't get accepted because it misses a documentation update.
>
> Maybe we should go upstream and ask advice...
I opened a PR here: https://github.com/mesonbuild/meson/pull/6629.
I already got some feedback however I don't know yet if it will be accepted.
>
>
> Regards,
> Arnout
>
> > + libcmd.append('--static')
> > + # Force pkg-config to output -L fields even if they are system
> > + # paths so we can do manual searching with cc.find_library() later.
> > +--
> > +2.24.1
> > +
> > diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> > index 369e225b3e..d80c472de6 100644
> > --- a/package/meson/cross-compilation.conf.in
> > +++ b/package/meson/cross-compilation.conf.in
> > @@ -18,6 +18,7 @@ cpp_args = [@TARGET_CXXFLAGS@]
> > cpp_link_args = [@TARGET_LDFLAGS@]
> > sys_root = '@STAGING_DIR@'
> > pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
> > +pkg_config_static = '@STATIC@'
> >
> > [host_machine]
> > system = 'linux'
> > diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> > index 642b715938..9482845cd3 100644
> > --- a/package/pkg-meson.mk
> > +++ b/package/pkg-meson.mk
> > @@ -76,6 +76,7 @@ define $(2)_CONFIGURE_CMDS
> > -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
> > -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
> > -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
> > + -e 's%@STATIC@%$$(if $$(BR2_STATIC_LIBS),true,false)%g' \
> > $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
> > -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
> > ) \
> >
Best Regards,
Fabrice
^ permalink raw reply
* [PULL 07/13] linux-user: Use `qemu_log' for strace
From: Laurent Vivier @ 2020-02-20 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Riku Voipio, Laurent Vivier, Josh Kunz, Aleksandar Markovic,
Aleksandar Rikalo, Aurelien Jarno
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>
From: Josh Kunz <jkz@google.com>
This change switches linux-user strace logging to use the newer `qemu_log`
logging subsystem rather than the older `gemu_log` (notice the "g")
logger. `qemu_log` has several advantages, namely that it allows logging
to a file, and provides a more unified interface for configuration
of logging (via the QEMU_LOG environment variable or options).
This change introduces a new log mask: `LOG_STRACE` which is used for
logging of user-mode strace messages.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Josh Kunz <jkz@google.com>
Message-Id: <20200204025416.111409-3-jkz@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
include/qemu/log.h | 2 +
linux-user/main.c | 30 ++-
linux-user/qemu.h | 1 -
linux-user/signal.c | 2 +-
linux-user/strace.c | 479 ++++++++++++++++++++++---------------------
linux-user/syscall.c | 13 +-
util/log.c | 2 +
7 files changed, 278 insertions(+), 251 deletions(-)
diff --git a/include/qemu/log.h b/include/qemu/log.h
index e0f4e4062838..f4724f733011 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -62,6 +62,8 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_TB_OP_IND (1 << 16)
#define CPU_LOG_TB_FPU (1 << 17)
#define CPU_LOG_PLUGIN (1 << 18)
+/* LOG_STRACE is used for user-mode strace logging. */
+#define LOG_STRACE (1 << 19)
/* Lock output for a series of related logs. Since this is not needed
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
diff --git a/linux-user/main.c b/linux-user/main.c
index fba833aac918..8f1d07cdd6a7 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -60,6 +60,19 @@ unsigned long mmap_min_addr;
unsigned long guest_base;
int have_guest_base;
+/*
+ * Used to implement backwards-compatibility for the `-strace`, and
+ * QEMU_STRACE options. Without this, the QEMU_LOG can be overwritten by
+ * -strace, or vice versa.
+ */
+static bool enable_strace;
+
+/*
+ * The last log mask given by the user in an environment variable or argument.
+ * Used to support command line arguments overriding environment variables.
+ */
+static int last_log_mask;
+
/*
* When running 32-on-64 we should make sure we can fit all of the possible
* guest address space into a contiguous chunk of virtual host memory.
@@ -223,15 +236,11 @@ static void handle_arg_help(const char *arg)
static void handle_arg_log(const char *arg)
{
- int mask;
-
- mask = qemu_str_to_log_mask(arg);
- if (!mask) {
+ last_log_mask = qemu_str_to_log_mask(arg);
+ if (!last_log_mask) {
qemu_print_log_usage(stdout);
exit(EXIT_FAILURE);
}
- qemu_log_needs_buffers();
- qemu_set_log(mask);
}
static void handle_arg_dfilter(const char *arg)
@@ -375,7 +384,7 @@ static void handle_arg_singlestep(const char *arg)
static void handle_arg_strace(const char *arg)
{
- do_strace = 1;
+ enable_strace = true;
}
static void handle_arg_version(const char *arg)
@@ -629,6 +638,7 @@ int main(int argc, char **argv, char **envp)
int i;
int ret;
int execfd;
+ int log_mask;
unsigned long max_reserved_va;
error_init(argv[0]);
@@ -661,6 +671,12 @@ int main(int argc, char **argv, char **envp)
optind = parse_args(argc, argv);
+ log_mask = last_log_mask | (enable_strace ? LOG_STRACE : 0);
+ if (log_mask) {
+ qemu_log_needs_buffers();
+ qemu_set_log(log_mask);
+ }
+
if (!trace_init_backends()) {
exit(1);
}
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 560a68090e14..2421dc7afd7a 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -386,7 +386,6 @@ void print_syscall_ret(int num, abi_long arg1);
* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
*/
void print_taken_signal(int target_signum, const target_siginfo_t *tinfo);
-extern int do_strace;
/* signal.c */
void process_pending_signals(CPUArchState *cpu_env);
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 94259dd07064..8cf51ffecde6 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -934,7 +934,7 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
handler = sa->_sa_handler;
}
- if (do_strace) {
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_taken_signal(sig, &k->info);
}
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 3d4d6844500e..4f7130b2ff63 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -12,8 +12,6 @@
#include <sched.h>
#include "qemu.h"
-int do_strace=0;
-
struct syscallname {
int nr;
const char *name;
@@ -80,7 +78,7 @@ print_ipc_cmd(int cmd)
{
#define output_cmd(val) \
if( cmd == val ) { \
- gemu_log(#val); \
+ qemu_log(#val); \
return; \
}
@@ -120,7 +118,7 @@ if( cmd == val ) { \
output_cmd( IPC_RMID );
/* Some value we don't recognize */
- gemu_log("%d",cmd);
+ qemu_log("%d", cmd);
}
static void
@@ -151,7 +149,7 @@ print_signal(abi_ulong arg, int last)
print_raw_param("%ld", arg, last);
return;
}
- gemu_log("%s%s", signal_name, get_comma(last));
+ qemu_log("%s%s", signal_name, get_comma(last));
}
static void print_si_code(int arg)
@@ -184,10 +182,10 @@ static void print_si_code(int arg)
codename = "SI_TKILL";
break;
default:
- gemu_log("%d", arg);
+ qemu_log("%d", arg);
return;
}
- gemu_log("%s", codename);
+ qemu_log("%s", codename);
}
static void get_target_siginfo(target_siginfo_t *tinfo,
@@ -288,33 +286,33 @@ static void print_siginfo(const target_siginfo_t *tinfo)
int si_type = extract32(tinfo->si_code, 16, 16);
int si_code = sextract32(tinfo->si_code, 0, 16);
- gemu_log("{si_signo=");
+ qemu_log("{si_signo=");
print_signal(tinfo->si_signo, 1);
- gemu_log(", si_code=");
+ qemu_log(", si_code=");
print_si_code(si_code);
switch (si_type) {
case QEMU_SI_KILL:
- gemu_log(", si_pid=%u, si_uid=%u",
+ qemu_log(", si_pid=%u, si_uid=%u",
(unsigned int)tinfo->_sifields._kill._pid,
(unsigned int)tinfo->_sifields._kill._uid);
break;
case QEMU_SI_TIMER:
- gemu_log(", si_timer1=%u, si_timer2=%u",
+ qemu_log(", si_timer1=%u, si_timer2=%u",
tinfo->_sifields._timer._timer1,
tinfo->_sifields._timer._timer2);
break;
case QEMU_SI_POLL:
- gemu_log(", si_band=%d, si_fd=%d",
+ qemu_log(", si_band=%d, si_fd=%d",
tinfo->_sifields._sigpoll._band,
tinfo->_sifields._sigpoll._fd);
break;
case QEMU_SI_FAULT:
- gemu_log(", si_addr=");
+ qemu_log(", si_addr=");
print_pointer(tinfo->_sifields._sigfault._addr, 1);
break;
case QEMU_SI_CHLD:
- gemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
+ qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
", si_utime=" TARGET_ABI_FMT_ld
", si_stime=" TARGET_ABI_FMT_ld,
(unsigned int)(tinfo->_sifields._sigchld._pid),
@@ -324,7 +322,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
tinfo->_sifields._sigchld._stime);
break;
case QEMU_SI_RT:
- gemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,
+ qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,
(unsigned int)tinfo->_sifields._rt._pid,
(unsigned int)tinfo->_sifields._rt._uid,
tinfo->_sifields._rt._sigval.sival_ptr);
@@ -332,7 +330,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
default:
g_assert_not_reached();
}
- gemu_log("}");
+ qemu_log("}");
}
static void
@@ -349,76 +347,76 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last)
case AF_UNIX: {
struct target_sockaddr_un *un = (struct target_sockaddr_un *)sa;
int i;
- gemu_log("{sun_family=AF_UNIX,sun_path=\"");
+ qemu_log("{sun_family=AF_UNIX,sun_path=\"");
for (i = 0; i < addrlen -
offsetof(struct target_sockaddr_un, sun_path) &&
un->sun_path[i]; i++) {
- gemu_log("%c", un->sun_path[i]);
+ qemu_log("%c", un->sun_path[i]);
}
- gemu_log("\"}");
+ qemu_log("\"}");
break;
}
case AF_INET: {
struct target_sockaddr_in *in = (struct target_sockaddr_in *)sa;
uint8_t *c = (uint8_t *)&in->sin_addr.s_addr;
- gemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
+ qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
ntohs(in->sin_port));
- gemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
+ qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
c[0], c[1], c[2], c[3]);
- gemu_log("}");
+ qemu_log("}");
break;
}
case AF_PACKET: {
struct target_sockaddr_ll *ll = (struct target_sockaddr_ll *)sa;
uint8_t *c = (uint8_t *)&ll->sll_addr;
- gemu_log("{sll_family=AF_PACKET,"
+ qemu_log("{sll_family=AF_PACKET,"
"sll_protocol=htons(0x%04x),if%d,pkttype=",
ntohs(ll->sll_protocol), ll->sll_ifindex);
switch (ll->sll_pkttype) {
case PACKET_HOST:
- gemu_log("PACKET_HOST");
+ qemu_log("PACKET_HOST");
break;
case PACKET_BROADCAST:
- gemu_log("PACKET_BROADCAST");
+ qemu_log("PACKET_BROADCAST");
break;
case PACKET_MULTICAST:
- gemu_log("PACKET_MULTICAST");
+ qemu_log("PACKET_MULTICAST");
break;
case PACKET_OTHERHOST:
- gemu_log("PACKET_OTHERHOST");
+ qemu_log("PACKET_OTHERHOST");
break;
case PACKET_OUTGOING:
- gemu_log("PACKET_OUTGOING");
+ qemu_log("PACKET_OUTGOING");
break;
default:
- gemu_log("%d", ll->sll_pkttype);
+ qemu_log("%d", ll->sll_pkttype);
break;
}
- gemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+ qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
- gemu_log("}");
+ qemu_log("}");
break;
}
case AF_NETLINK: {
struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa;
- gemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
+ qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
tswap32(nl->nl_pid), tswap32(nl->nl_groups));
break;
}
default:
- gemu_log("{sa_family=%d, sa_data={", sa->sa_family);
+ qemu_log("{sa_family=%d, sa_data={", sa->sa_family);
for (i = 0; i < 13; i++) {
- gemu_log("%02x, ", sa->sa_data[i]);
+ qemu_log("%02x, ", sa->sa_data[i]);
}
- gemu_log("%02x}", sa->sa_data[i]);
- gemu_log("}");
+ qemu_log("%02x}", sa->sa_data[i]);
+ qemu_log("}");
break;
}
unlock_user(sa, addr, 0);
} else {
print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);
}
- gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
+ qemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
}
static void
@@ -426,19 +424,19 @@ print_socket_domain(int domain)
{
switch (domain) {
case PF_UNIX:
- gemu_log("PF_UNIX");
+ qemu_log("PF_UNIX");
break;
case PF_INET:
- gemu_log("PF_INET");
+ qemu_log("PF_INET");
break;
case PF_NETLINK:
- gemu_log("PF_NETLINK");
+ qemu_log("PF_NETLINK");
break;
case PF_PACKET:
- gemu_log("PF_PACKET");
+ qemu_log("PF_PACKET");
break;
default:
- gemu_log("%d", domain);
+ qemu_log("%d", domain);
break;
}
}
@@ -448,22 +446,22 @@ print_socket_type(int type)
{
switch (type) {
case TARGET_SOCK_DGRAM:
- gemu_log("SOCK_DGRAM");
+ qemu_log("SOCK_DGRAM");
break;
case TARGET_SOCK_STREAM:
- gemu_log("SOCK_STREAM");
+ qemu_log("SOCK_STREAM");
break;
case TARGET_SOCK_RAW:
- gemu_log("SOCK_RAW");
+ qemu_log("SOCK_RAW");
break;
case TARGET_SOCK_RDM:
- gemu_log("SOCK_RDM");
+ qemu_log("SOCK_RDM");
break;
case TARGET_SOCK_SEQPACKET:
- gemu_log("SOCK_SEQPACKET");
+ qemu_log("SOCK_SEQPACKET");
break;
case TARGET_SOCK_PACKET:
- gemu_log("SOCK_PACKET");
+ qemu_log("SOCK_PACKET");
break;
}
}
@@ -475,10 +473,10 @@ print_socket_protocol(int domain, int type, int protocol)
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
switch (protocol) {
case 0x0003:
- gemu_log("ETH_P_ALL");
+ qemu_log("ETH_P_ALL");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
}
return;
}
@@ -486,25 +484,25 @@ print_socket_protocol(int domain, int type, int protocol)
if (domain == PF_NETLINK) {
switch (protocol) {
case NETLINK_ROUTE:
- gemu_log("NETLINK_ROUTE");
+ qemu_log("NETLINK_ROUTE");
break;
case NETLINK_AUDIT:
- gemu_log("NETLINK_AUDIT");
+ qemu_log("NETLINK_AUDIT");
break;
case NETLINK_NETFILTER:
- gemu_log("NETLINK_NETFILTER");
+ qemu_log("NETLINK_NETFILTER");
break;
case NETLINK_KOBJECT_UEVENT:
- gemu_log("NETLINK_KOBJECT_UEVENT");
+ qemu_log("NETLINK_KOBJECT_UEVENT");
break;
case NETLINK_RDMA:
- gemu_log("NETLINK_RDMA");
+ qemu_log("NETLINK_RDMA");
break;
case NETLINK_CRYPTO:
- gemu_log("NETLINK_CRYPTO");
+ qemu_log("NETLINK_CRYPTO");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
break;
}
return;
@@ -512,19 +510,19 @@ print_socket_protocol(int domain, int type, int protocol)
switch (protocol) {
case IPPROTO_IP:
- gemu_log("IPPROTO_IP");
+ qemu_log("IPPROTO_IP");
break;
case IPPROTO_TCP:
- gemu_log("IPPROTO_TCP");
+ qemu_log("IPPROTO_TCP");
break;
case IPPROTO_UDP:
- gemu_log("IPPROTO_UDP");
+ qemu_log("IPPROTO_UDP");
break;
case IPPROTO_RAW:
- gemu_log("IPPROTO_RAW");
+ qemu_log("IPPROTO_RAW");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
break;
}
}
@@ -536,7 +534,7 @@ print_fdset(int n, abi_ulong target_fds_addr)
{
int i;
- gemu_log("[");
+ qemu_log("[");
if( target_fds_addr ) {
abi_long *target_fds;
@@ -550,11 +548,11 @@ print_fdset(int n, abi_ulong target_fds_addr)
for (i=n; i>=0; i--) {
if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >> (i & (TARGET_ABI_BITS - 1))) & 1)
- gemu_log("%d,", i );
+ qemu_log("%d,", i);
}
unlock_user(target_fds, target_fds_addr, 0);
}
- gemu_log("]");
+ qemu_log("]");
}
#endif
@@ -578,46 +576,46 @@ print_clockid(int clockid, int last)
{
switch (clockid) {
case TARGET_CLOCK_REALTIME:
- gemu_log("CLOCK_REALTIME");
+ qemu_log("CLOCK_REALTIME");
break;
case TARGET_CLOCK_MONOTONIC:
- gemu_log("CLOCK_MONOTONIC");
+ qemu_log("CLOCK_MONOTONIC");
break;
case TARGET_CLOCK_PROCESS_CPUTIME_ID:
- gemu_log("CLOCK_PROCESS_CPUTIME_ID");
+ qemu_log("CLOCK_PROCESS_CPUTIME_ID");
break;
case TARGET_CLOCK_THREAD_CPUTIME_ID:
- gemu_log("CLOCK_THREAD_CPUTIME_ID");
+ qemu_log("CLOCK_THREAD_CPUTIME_ID");
break;
case TARGET_CLOCK_MONOTONIC_RAW:
- gemu_log("CLOCK_MONOTONIC_RAW");
+ qemu_log("CLOCK_MONOTONIC_RAW");
break;
case TARGET_CLOCK_REALTIME_COARSE:
- gemu_log("CLOCK_REALTIME_COARSE");
+ qemu_log("CLOCK_REALTIME_COARSE");
break;
case TARGET_CLOCK_MONOTONIC_COARSE:
- gemu_log("CLOCK_MONOTONIC_COARSE");
+ qemu_log("CLOCK_MONOTONIC_COARSE");
break;
case TARGET_CLOCK_BOOTTIME:
- gemu_log("CLOCK_BOOTTIME");
+ qemu_log("CLOCK_BOOTTIME");
break;
case TARGET_CLOCK_REALTIME_ALARM:
- gemu_log("CLOCK_REALTIME_ALARM");
+ qemu_log("CLOCK_REALTIME_ALARM");
break;
case TARGET_CLOCK_BOOTTIME_ALARM:
- gemu_log("CLOCK_BOOTTIME_ALARM");
+ qemu_log("CLOCK_BOOTTIME_ALARM");
break;
case TARGET_CLOCK_SGI_CYCLE:
- gemu_log("CLOCK_SGI_CYCLE");
+ qemu_log("CLOCK_SGI_CYCLE");
break;
case TARGET_CLOCK_TAI:
- gemu_log("CLOCK_TAI");
+ qemu_log("CLOCK_TAI");
break;
default:
- gemu_log("%d", clockid);
+ qemu_log("%d", clockid);
break;
}
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
#endif
@@ -638,15 +636,15 @@ print_newselect(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
- gemu_log("%s(" TARGET_ABI_FMT_ld ",", name->name, arg1);
+ qemu_log("%s(" TARGET_ABI_FMT_ld ",", name->name, arg1);
print_fdset(arg1, arg2);
- gemu_log(",");
+ qemu_log(",");
print_fdset(arg1, arg3);
- gemu_log(",");
+ qemu_log(",");
print_fdset(arg1, arg4);
- gemu_log(",");
+ qemu_log(",");
print_timeval(arg5, 1);
- gemu_log(")");
+ qemu_log(")");
/* save for use in the return output function below */
newselect_arg1=arg1;
@@ -663,9 +661,10 @@ print_semctl(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
- gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", name->name, arg1, arg2);
+ qemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",",
+ name->name, arg1, arg2);
print_ipc_cmd(arg3);
- gemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
+ qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
}
#endif
@@ -679,7 +678,7 @@ print_execve(const struct syscallname *name,
if (!(s = lock_user_string(arg1)))
return;
- gemu_log("%s(\"%s\",{", name->name, s);
+ qemu_log("%s(\"%s\",{", name->name, s);
unlock_user(s, arg1, 0);
for (arg_ptr_addr = arg2; ; arg_ptr_addr += sizeof(abi_ulong)) {
@@ -693,12 +692,12 @@ print_execve(const struct syscallname *name,
if (!arg_addr)
break;
if ((s = lock_user_string(arg_addr))) {
- gemu_log("\"%s\",", s);
+ qemu_log("\"%s\",", s);
unlock_user(s, arg_addr, 0);
}
}
- gemu_log("NULL})");
+ qemu_log("NULL})");
}
#ifdef TARGET_NR_ipc
@@ -709,12 +708,18 @@ print_ipc(const struct syscallname *name,
{
switch(arg1) {
case IPCOP_semctl:
- gemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", arg1, arg2);
+ qemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",",
+ arg1, arg2);
print_ipc_cmd(arg3);
- gemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
+ qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
break;
default:
- gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")",
+ qemu_log(("%s("
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld
+ ")"),
name->name, arg1, arg2, arg3, arg4);
}
}
@@ -733,9 +738,9 @@ print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
errstr = target_strerror(-ret);
}
if (errstr) {
- gemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
+ qemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
} else {
- gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}
}
@@ -743,7 +748,7 @@ print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
static void
print_syscall_ret_raw(struct syscallname *name, abi_long ret)
{
- gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}
#endif
@@ -751,15 +756,15 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret)
static void
print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
{
- gemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
print_fdset(newselect_arg1,newselect_arg2);
- gemu_log(",");
+ qemu_log(",");
print_fdset(newselect_arg1,newselect_arg3);
- gemu_log(",");
+ qemu_log(",");
print_fdset(newselect_arg1,newselect_arg4);
- gemu_log(",");
+ qemu_log(",");
print_timeval(newselect_arg5, 1);
- gemu_log(")\n");
+ qemu_log(")\n");
}
#endif
@@ -775,38 +780,38 @@ print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
{
const char *errstr = NULL;
- gemu_log(" = ");
+ qemu_log(" = ");
if (ret < 0) {
- gemu_log("-1 errno=%d", errno);
+ qemu_log("-1 errno=%d", errno);
errstr = target_strerror(-ret);
if (errstr) {
- gemu_log(" (%s)", errstr);
+ qemu_log(" (%s)", errstr);
}
} else {
- gemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(TARGET_ABI_FMT_ld, ret);
switch (ret) {
case TARGET_TIME_OK:
- gemu_log(" TIME_OK (clock synchronized, no leap second)");
+ qemu_log(" TIME_OK (clock synchronized, no leap second)");
break;
case TARGET_TIME_INS:
- gemu_log(" TIME_INS (insert leap second)");
+ qemu_log(" TIME_INS (insert leap second)");
break;
case TARGET_TIME_DEL:
- gemu_log(" TIME_DEL (delete leap second)");
+ qemu_log(" TIME_DEL (delete leap second)");
break;
case TARGET_TIME_OOP:
- gemu_log(" TIME_OOP (leap second in progress)");
+ qemu_log(" TIME_OOP (leap second in progress)");
break;
case TARGET_TIME_WAIT:
- gemu_log(" TIME_WAIT (leap second has occurred)");
+ qemu_log(" TIME_WAIT (leap second has occurred)");
break;
case TARGET_TIME_ERROR:
- gemu_log(" TIME_ERROR (clock not synchronized)");
+ qemu_log(" TIME_ERROR (clock not synchronized)");
break;
}
}
- gemu_log("\n");
+ qemu_log("\n");
}
UNUSED static struct flags access_flags[] = {
@@ -1104,12 +1109,12 @@ print_flags(const struct flags *f, abi_long flags, int last)
int n;
if ((flags == 0) && (f->f_value == 0)) {
- gemu_log("%s%s", f->f_string, get_comma(last));
+ qemu_log("%s%s", f->f_string, get_comma(last));
return;
}
for (n = 0; f->f_string != NULL; f++) {
if ((f->f_value != 0) && ((flags & f->f_value) == f->f_value)) {
- gemu_log("%s%s", sep, f->f_string);
+ qemu_log("%s%s", sep, f->f_string);
flags &= ~f->f_value;
sep = "|";
n++;
@@ -1119,13 +1124,13 @@ print_flags(const struct flags *f, abi_long flags, int last)
if (n > 0) {
/* print rest of the flags as numeric */
if (flags != 0) {
- gemu_log("%s%#x%s", sep, (unsigned int)flags, get_comma(last));
+ qemu_log("%s%#x%s", sep, (unsigned int)flags, get_comma(last));
} else {
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
} else {
/* no string version of flags found, print them in hex then */
- gemu_log("%#x%s", (unsigned int)flags, get_comma(last));
+ qemu_log("%#x%s", (unsigned int)flags, get_comma(last));
}
}
@@ -1134,11 +1139,11 @@ print_at_dirfd(abi_long dirfd, int last)
{
#ifdef AT_FDCWD
if (dirfd == AT_FDCWD) {
- gemu_log("AT_FDCWD%s", get_comma(last));
+ qemu_log("AT_FDCWD%s", get_comma(last));
return;
}
#endif
- gemu_log("%d%s", (int)dirfd, get_comma(last));
+ qemu_log("%d%s", (int)dirfd, get_comma(last));
}
static void
@@ -1149,7 +1154,7 @@ print_file_mode(abi_long mode, int last)
for (m = &mode_flags[0]; m->f_string != NULL; m++) {
if ((m->f_value & mode) == m->f_value) {
- gemu_log("%s%s", m->f_string, sep);
+ qemu_log("%s%s", m->f_string, sep);
sep = "|";
mode &= ~m->f_value;
break;
@@ -1159,9 +1164,9 @@ print_file_mode(abi_long mode, int last)
mode &= ~S_IFMT;
/* print rest of the mode as octal */
if (mode != 0)
- gemu_log("%s%#o", sep, (unsigned int)mode);
+ qemu_log("%s%#o", sep, (unsigned int)mode);
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
static void
@@ -1170,17 +1175,17 @@ print_open_flags(abi_long flags, int last)
print_flags(open_access_flags, flags & TARGET_O_ACCMODE, 1);
flags &= ~TARGET_O_ACCMODE;
if (flags == 0) {
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
return;
}
- gemu_log("|");
+ qemu_log("|");
print_flags(open_flags, flags, last);
}
static void
print_syscall_prologue(const struct syscallname *sc)
{
- gemu_log("%s(", sc->name);
+ qemu_log("%s(", sc->name);
}
/*ARGSUSED*/
@@ -1188,7 +1193,7 @@ static void
print_syscall_epilogue(const struct syscallname *sc)
{
(void)sc;
- gemu_log(")");
+ qemu_log(")");
}
static void
@@ -1197,7 +1202,7 @@ print_string(abi_long addr, int last)
char *s;
if ((s = lock_user_string(addr)) != NULL) {
- gemu_log("\"%s\"%s", s, get_comma(last));
+ qemu_log("\"%s\"%s", s, get_comma(last));
unlock_user(s, addr, 0);
} else {
/* can't get string out of it, so print it as pointer */
@@ -1214,20 +1219,20 @@ print_buf(abi_long addr, abi_long len, int last)
s = lock_user(VERIFY_READ, addr, len, 1);
if (s) {
- gemu_log("\"");
+ qemu_log("\"");
for (i = 0; i < MAX_PRINT_BUF && i < len; i++) {
if (isprint(s[i])) {
- gemu_log("%c", s[i]);
+ qemu_log("%c", s[i]);
} else {
- gemu_log("\\%o", s[i]);
+ qemu_log("\\%o", s[i]);
}
}
- gemu_log("\"");
+ qemu_log("\"");
if (i != len) {
- gemu_log("...");
+ qemu_log("...");
}
if (!last) {
- gemu_log(",");
+ qemu_log(",");
}
unlock_user(s, addr, 0);
} else {
@@ -1245,16 +1250,16 @@ print_raw_param(const char *fmt, abi_long param, int last)
char format[64];
(void) snprintf(format, sizeof (format), "%s%s", fmt, get_comma(last));
- gemu_log(format, param);
+ qemu_log(format, param);
}
static void
print_pointer(abi_long p, int last)
{
if (p == 0)
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
else
- gemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last));
+ qemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last));
}
/*
@@ -1265,12 +1270,12 @@ static void
print_number(abi_long addr, int last)
{
if (addr == 0) {
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
} else {
int num;
get_user_s32(num, addr);
- gemu_log("[%d]%s", num, get_comma(last));
+ qemu_log("[%d]%s", num, get_comma(last));
}
}
@@ -1285,11 +1290,11 @@ print_timeval(abi_ulong tv_addr, int last)
print_pointer(tv_addr, last);
return;
}
- gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s",
+ qemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s",
tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last));
unlock_user(tv, tv_addr, 0);
} else
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
}
static void
@@ -1303,11 +1308,11 @@ print_timezone(abi_ulong tz_addr, int last)
print_pointer(tz_addr, last);
return;
}
- gemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest),
+ qemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest),
tswap32(tz->tz_dsttime), get_comma(last));
unlock_user(tz, tz_addr, 0);
} else {
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
}
}
@@ -1515,83 +1520,83 @@ print_fcntl(const struct syscallname *name,
print_raw_param("%d", arg0, 0);
switch(arg1) {
case TARGET_F_DUPFD:
- gemu_log("F_DUPFD,");
+ qemu_log("F_DUPFD,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETFD:
- gemu_log("F_GETFD");
+ qemu_log("F_GETFD");
break;
case TARGET_F_SETFD:
- gemu_log("F_SETFD,");
+ qemu_log("F_SETFD,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETFL:
- gemu_log("F_GETFL");
+ qemu_log("F_GETFL");
break;
case TARGET_F_SETFL:
- gemu_log("F_SETFL,");
+ qemu_log("F_SETFL,");
print_open_flags(arg2, 1);
break;
case TARGET_F_GETLK:
- gemu_log("F_GETLK,");
+ qemu_log("F_GETLK,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLK:
- gemu_log("F_SETLK,");
+ qemu_log("F_SETLK,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLKW:
- gemu_log("F_SETLKW,");
+ qemu_log("F_SETLKW,");
print_pointer(arg2, 1);
break;
case TARGET_F_GETOWN:
- gemu_log("F_GETOWN");
+ qemu_log("F_GETOWN");
break;
case TARGET_F_SETOWN:
- gemu_log("F_SETOWN,");
+ qemu_log("F_SETOWN,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
case TARGET_F_GETSIG:
- gemu_log("F_GETSIG");
+ qemu_log("F_GETSIG");
break;
case TARGET_F_SETSIG:
- gemu_log("F_SETSIG,");
+ qemu_log("F_SETSIG,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
#if TARGET_ABI_BITS == 32
case TARGET_F_GETLK64:
- gemu_log("F_GETLK64,");
+ qemu_log("F_GETLK64,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLK64:
- gemu_log("F_SETLK64,");
+ qemu_log("F_SETLK64,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLKW64:
- gemu_log("F_SETLKW64,");
+ qemu_log("F_SETLKW64,");
print_pointer(arg2, 1);
break;
#endif
case TARGET_F_SETLEASE:
- gemu_log("F_SETLEASE,");
+ qemu_log("F_SETLEASE,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
case TARGET_F_GETLEASE:
- gemu_log("F_GETLEASE");
+ qemu_log("F_GETLEASE");
break;
case TARGET_F_SETPIPE_SZ:
- gemu_log("F_SETPIPE_SZ,");
+ qemu_log("F_SETPIPE_SZ,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETPIPE_SZ:
- gemu_log("F_GETPIPE_SZ");
+ qemu_log("F_GETPIPE_SZ");
break;
case TARGET_F_DUPFD_CLOEXEC:
- gemu_log("F_DUPFD_CLOEXEC,");
+ qemu_log("F_DUPFD_CLOEXEC,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_NOTIFY:
- gemu_log("F_NOTIFY,");
+ qemu_log("F_NOTIFY,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
default:
@@ -1679,7 +1684,7 @@ print__llseek(const struct syscallname *name,
case SEEK_CUR: whence = "SEEK_CUR"; break;
case SEEK_END: whence = "SEEK_END"; break;
}
- gemu_log("%s",whence);
+ qemu_log("%s", whence);
print_syscall_epilogue(name);
}
#endif
@@ -1694,9 +1699,9 @@ print_socket(const struct syscallname *name,
print_syscall_prologue(name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
if (domain == AF_PACKET ||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
protocol = tswap16(protocol);
@@ -1728,17 +1733,17 @@ static void do_print_socket(const char *name, abi_long arg1)
get_user_ualx(domain, arg1, 0);
get_user_ualx(type, arg1, 1);
get_user_ualx(protocol, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
if (domain == AF_PACKET ||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
protocol = tswap16(protocol);
}
print_socket_protocol(domain, type, protocol);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sockaddr(const char *name, abi_long arg1)
@@ -1749,10 +1754,10 @@ static void do_print_sockaddr(const char *name, abi_long arg1)
get_user_ualx(addr, arg1, 1);
get_user_ualx(addrlen, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_sockaddr(addr, addrlen, 0);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_listen(const char *name, abi_long arg1)
@@ -1762,10 +1767,10 @@ static void do_print_listen(const char *name, abi_long arg1)
get_user_ualx(sockfd, arg1, 0);
get_user_ualx(backlog, arg1, 1);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_raw_param(TARGET_ABI_FMT_ld, backlog, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_socketpair(const char *name, abi_long arg1)
@@ -1777,15 +1782,15 @@ static void do_print_socketpair(const char *name, abi_long arg1)
get_user_ualx(protocol, arg1, 2);
get_user_ualx(tab, arg1, 3);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
print_socket_protocol(domain, type, protocol);
- gemu_log(",");
+ qemu_log(",");
print_raw_param(TARGET_ABI_FMT_lx, tab, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sendrecv(const char *name, abi_long arg1)
@@ -1797,12 +1802,12 @@ static void do_print_sendrecv(const char *name, abi_long arg1)
get_user_ualx(len, arg1, 2);
get_user_ualx(flags, arg1, 3);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_buf(msg, len, 0);
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
print_flags(msg_flags, flags, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_msgaddr(const char *name, abi_long arg1)
@@ -1816,13 +1821,13 @@ static void do_print_msgaddr(const char *name, abi_long arg1)
get_user_ualx(addr, arg1, 4);
get_user_ualx(addrlen, arg1, 5);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_buf(msg, len, 0);
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
print_flags(msg_flags, flags, 0);
print_sockaddr(addr, addrlen, 0);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_shutdown(const char *name, abi_long arg1)
@@ -1832,23 +1837,23 @@ static void do_print_shutdown(const char *name, abi_long arg1)
get_user_ualx(sockfd, arg1, 0);
get_user_ualx(how, arg1, 1);
- gemu_log("shutdown(");
+ qemu_log("shutdown(");
print_sockfd(sockfd, 0);
switch (how) {
case SHUT_RD:
- gemu_log("SHUT_RD");
+ qemu_log("SHUT_RD");
break;
case SHUT_WR:
- gemu_log("SHUT_WR");
+ qemu_log("SHUT_WR");
break;
case SHUT_RDWR:
- gemu_log("SHUT_RDWR");
+ qemu_log("SHUT_RDWR");
break;
default:
print_raw_param(TARGET_ABI_FMT_ld, how, 1);
break;
}
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_msg(const char *name, abi_long arg1)
@@ -1859,11 +1864,11 @@ static void do_print_msg(const char *name, abi_long arg1)
get_user_ualx(msg, arg1, 1);
get_user_ualx(flags, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_pointer(msg, 0);
print_flags(msg_flags, flags, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sockopt(const char *name, abi_long arg1)
@@ -1876,113 +1881,113 @@ static void do_print_sockopt(const char *name, abi_long arg1)
get_user_ualx(optval, arg1, 3);
get_user_ualx(optlen, arg1, 4);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
switch (level) {
case SOL_TCP:
- gemu_log("SOL_TCP,");
+ qemu_log("SOL_TCP,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case SOL_IP:
- gemu_log("SOL_IP,");
+ qemu_log("SOL_IP,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case SOL_RAW:
- gemu_log("SOL_RAW,");
+ qemu_log("SOL_RAW,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case TARGET_SOL_SOCKET:
- gemu_log("SOL_SOCKET,");
+ qemu_log("SOL_SOCKET,");
switch (optname) {
case TARGET_SO_DEBUG:
- gemu_log("SO_DEBUG,");
+ qemu_log("SO_DEBUG,");
print_optint:
print_number(optval, 0);
break;
case TARGET_SO_REUSEADDR:
- gemu_log("SO_REUSEADDR,");
+ qemu_log("SO_REUSEADDR,");
goto print_optint;
case TARGET_SO_REUSEPORT:
- gemu_log("SO_REUSEPORT,");
+ qemu_log("SO_REUSEPORT,");
goto print_optint;
case TARGET_SO_TYPE:
- gemu_log("SO_TYPE,");
+ qemu_log("SO_TYPE,");
goto print_optint;
case TARGET_SO_ERROR:
- gemu_log("SO_ERROR,");
+ qemu_log("SO_ERROR,");
goto print_optint;
case TARGET_SO_DONTROUTE:
- gemu_log("SO_DONTROUTE,");
+ qemu_log("SO_DONTROUTE,");
goto print_optint;
case TARGET_SO_BROADCAST:
- gemu_log("SO_BROADCAST,");
+ qemu_log("SO_BROADCAST,");
goto print_optint;
case TARGET_SO_SNDBUF:
- gemu_log("SO_SNDBUF,");
+ qemu_log("SO_SNDBUF,");
goto print_optint;
case TARGET_SO_RCVBUF:
- gemu_log("SO_RCVBUF,");
+ qemu_log("SO_RCVBUF,");
goto print_optint;
case TARGET_SO_KEEPALIVE:
- gemu_log("SO_KEEPALIVE,");
+ qemu_log("SO_KEEPALIVE,");
goto print_optint;
case TARGET_SO_OOBINLINE:
- gemu_log("SO_OOBINLINE,");
+ qemu_log("SO_OOBINLINE,");
goto print_optint;
case TARGET_SO_NO_CHECK:
- gemu_log("SO_NO_CHECK,");
+ qemu_log("SO_NO_CHECK,");
goto print_optint;
case TARGET_SO_PRIORITY:
- gemu_log("SO_PRIORITY,");
+ qemu_log("SO_PRIORITY,");
goto print_optint;
case TARGET_SO_BSDCOMPAT:
- gemu_log("SO_BSDCOMPAT,");
+ qemu_log("SO_BSDCOMPAT,");
goto print_optint;
case TARGET_SO_PASSCRED:
- gemu_log("SO_PASSCRED,");
+ qemu_log("SO_PASSCRED,");
goto print_optint;
case TARGET_SO_TIMESTAMP:
- gemu_log("SO_TIMESTAMP,");
+ qemu_log("SO_TIMESTAMP,");
goto print_optint;
case TARGET_SO_RCVLOWAT:
- gemu_log("SO_RCVLOWAT,");
+ qemu_log("SO_RCVLOWAT,");
goto print_optint;
case TARGET_SO_RCVTIMEO:
- gemu_log("SO_RCVTIMEO,");
+ qemu_log("SO_RCVTIMEO,");
print_timeval(optval, 0);
break;
case TARGET_SO_SNDTIMEO:
- gemu_log("SO_SNDTIMEO,");
+ qemu_log("SO_SNDTIMEO,");
print_timeval(optval, 0);
break;
case TARGET_SO_ATTACH_FILTER: {
struct target_sock_fprog *fprog;
- gemu_log("SO_ATTACH_FILTER,");
+ qemu_log("SO_ATTACH_FILTER,");
if (lock_user_struct(VERIFY_READ, fprog, optval, 0)) {
struct target_sock_filter *filter;
- gemu_log("{");
+ qemu_log("{");
if (lock_user_struct(VERIFY_READ, filter,
tswapal(fprog->filter), 0)) {
int i;
for (i = 0; i < tswap16(fprog->len) - 1; i++) {
- gemu_log("[%d]{0x%x,%d,%d,0x%x},",
+ qemu_log("[%d]{0x%x,%d,%d,0x%x},",
i, tswap16(filter[i].code),
filter[i].jt, filter[i].jf,
tswap32(filter[i].k));
}
- gemu_log("[%d]{0x%x,%d,%d,0x%x}",
+ qemu_log("[%d]{0x%x,%d,%d,0x%x}",
i, tswap16(filter[i].code),
filter[i].jt, filter[i].jf,
tswap32(filter[i].k));
} else {
- gemu_log(TARGET_ABI_FMT_lx, tswapal(fprog->filter));
+ qemu_log(TARGET_ABI_FMT_lx, tswapal(fprog->filter));
}
- gemu_log(",%d},", tswap16(fprog->len));
+ qemu_log(",%d},", tswap16(fprog->len));
unlock_user(fprog, optval, 0);
} else {
print_pointer(optval, 0);
@@ -2002,7 +2007,7 @@ print_optint:
break;
}
print_raw_param(TARGET_ABI_FMT_ld, optlen, 1);
- gemu_log(")");
+ qemu_log(")");
}
#define PRINT_SOCKOP(name, func) \
@@ -2164,7 +2169,7 @@ print_rt_sigprocmask(const struct syscallname *name,
case TARGET_SIG_UNBLOCK: how = "SIG_UNBLOCK"; break;
case TARGET_SIG_SETMASK: how = "SIG_SETMASK"; break;
}
- gemu_log("%s,",how);
+ qemu_log("%s,", how);
print_pointer(arg1, 0);
print_pointer(arg2, 1);
print_syscall_epilogue(name);
@@ -2278,7 +2283,7 @@ print_syslog_action(abi_ulong arg, int last)
return;
}
}
- gemu_log("%s%s", type, get_comma(last));
+ qemu_log("%s%s", type, get_comma(last));
}
static void
@@ -2683,20 +2688,20 @@ static void print_futex_op(abi_long tflag, int last)
{
#define print_op(val) \
if( cmd == val ) { \
- gemu_log(#val); \
+ qemu_log(#val); \
return; \
}
int cmd = (int)tflag;
#ifdef FUTEX_PRIVATE_FLAG
if (cmd & FUTEX_PRIVATE_FLAG) {
- gemu_log("FUTEX_PRIVATE_FLAG|");
+ qemu_log("FUTEX_PRIVATE_FLAG|");
cmd &= ~FUTEX_PRIVATE_FLAG;
}
#endif
#ifdef FUTEX_CLOCK_REALTIME
if (cmd & FUTEX_CLOCK_REALTIME) {
- gemu_log("FUTEX_CLOCK_REALTIME|");
+ qemu_log("FUTEX_CLOCK_REALTIME|");
cmd &= ~FUTEX_CLOCK_REALTIME;
}
#endif
@@ -2716,7 +2721,7 @@ if( cmd == val ) { \
print_op(FUTEX_WAKE_BITSET)
#endif
/* unknown values */
- gemu_log("%d",cmd);
+ qemu_log("%d", cmd);
}
static void
@@ -2812,22 +2817,24 @@ print_syscall(int num,
int i;
const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")";
- gemu_log("%d ", getpid() );
+ qemu_log("%d ", getpid());
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].call != NULL ) {
- scnames[i].call(&scnames[i],arg1,arg2,arg3,arg4,arg5,arg6);
+ scnames[i].call(
+ &scnames[i], arg1, arg2, arg3, arg4, arg5, arg6);
} else {
/* XXX: this format system is broken because it uses
host types and host pointers for strings */
if( scnames[i].format != NULL )
format = scnames[i].format;
- gemu_log(format,scnames[i].name, arg1,arg2,arg3,arg4,arg5,arg6);
+ qemu_log(format,
+ scnames[i].name, arg1, arg2, arg3, arg4, arg5, arg6);
}
return;
}
- gemu_log("Unknown syscall %d\n", num);
+ qemu_log("Unknown syscall %d\n", num);
}
@@ -2840,16 +2847,16 @@ print_syscall_ret(int num, abi_long ret)
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].result != NULL ) {
- scnames[i].result(&scnames[i],ret);
+ scnames[i].result(&scnames[i], ret);
} else {
if (ret < 0) {
errstr = target_strerror(-ret);
}
if (errstr) {
- gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
+ qemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
-ret, errstr);
} else {
- gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
+ qemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
}
}
break;
@@ -2861,9 +2868,9 @@ void print_taken_signal(int target_signum, const target_siginfo_t *tinfo)
/* Print the strace output for a signal being taken:
* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
*/
- gemu_log("--- ");
+ qemu_log("--- ");
print_signal(target_signum, 1);
- gemu_log(" ");
+ qemu_log(" ");
print_siginfo(tinfo);
- gemu_log(" ---\n");
+ qemu_log(" ---\n");
}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 16d98c1ff5ff..274e10e0ee6b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -12171,14 +12171,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
record_syscall_start(cpu, num, arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
- if (unlikely(do_strace)) {
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
- ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
+ }
+
+ ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
+ arg5, arg6, arg7, arg8);
+
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall_ret(num, ret);
- } else {
- ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
}
record_syscall_return(cpu, num, ret);
diff --git a/util/log.c b/util/log.c
index 47f2827397b6..2da6cb31dcfa 100644
--- a/util/log.c
+++ b/util/log.c
@@ -332,6 +332,8 @@ const QEMULogItem qemu_log_items[] = {
#ifdef CONFIG_PLUGIN
{ CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"},
#endif
+ { LOG_STRACE, "strace",
+ "log every user-mode syscall, its input, and its result" },
{ 0, NULL, NULL },
};
--
2.24.1
^ permalink raw reply related
* Re: [Xen-devel] [PATCH] xen/sched: rework credit2 run-queue allocation
From: Dario Faggioli @ 2020-02-20 9:28 UTC (permalink / raw)
To: Jürgen Groß; +Cc: George Dunlap, xen-devel, Jan Beulich
In-Reply-To: <40a41da6-64a0-d332-c544-0eb937204fa6@suse.com>
[-- Attachment #1.1: Type: text/plain, Size: 1864 bytes --]
On Thu, 2020-02-20 at 07:56 +0100, Jürgen Groß wrote:
> On 19.02.20 19:37, Dario Faggioli wrote:
> > On Wed, 2020-02-19 at 17:52 +0100, Jan Beulich wrote:
> > >
> > Nevertheless, I'd add a quick comment about that, to make it even
> > more
> > obvious. :-)
>
> Do we really need that?
>
> Calling any of the alloc functions with interrupts off will crash the
> system (at least in debug builds).
>
> I don't think we want to add such comments all over the code.
>
No, and that is not what I am suggesting we do. :-)
Neither I want to push to hard (or slow the patch down) just for this.
But, yes, I feel that considering how the code looks, in this
particular case, it is not entirely obvious to immediately realize that
that is the actual reason. Even more so, if we consider that it is not
such a common issue in scheduling code, where there is an (as much as
possible) clear split between allocation and init / usage phases (all
the *_alloc_*data() stuff).
Having just a one liner here would, I think, save people reading this
code some brain power, which they'll be able to use for focusing on
more scheduler specific issues.
Something like:
/* In case we need it, allocate a new runq now, before taking the lock. */
Anyway, as said, I don't want to push too hard on this. If you feel
strongly about not having something like that, I won't block the patch.
If I then decide that I really want such a comment, I will submit a
patch myself, and maybe we'll discuss the pros & cons of having it in
that thread. :-)
Thanks and Regards
--
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply
* Re: [RFC PATCH v3 4/6] media: tegra: Add Tegra210 Video input driver
From: Hans Verkuil @ 2020-02-20 9:29 UTC (permalink / raw)
To: Sowjanya Komatineni, thierry.reding, jonathanh, frankc,
helen.koike, sboyd
Cc: linux-media, devicetree, linux-clk, linux-tegra, linux-kernel
In-Reply-To: <3adacc07-7e3a-2d06-8d18-003b004ede17@nvidia.com>
On 2/20/20 1:09 AM, Sowjanya Komatineni wrote:
>> Thanks Hans. Probably dma address is not aligned properly. Will check.
>
>
> I see this time repro happened right on power up during 1st run of
> compliance test and it shows kernel write to read-only error right
> during vb2_core_qbuf -> buf_prepare.
>
> it happened after buffers allocation and during pre-queuing of buffers
> right before starting 1st stream on power up.
>
> Hi Thierry,
>
> Currently tegra vi driver don't use iommu. Could this be some issue with
> contig allocation as iommu is not being used?
Nothing to do with that. The root cause is that struct tegra_channel_buffer
must start with struct vb2_v4l2_buffer since that's what vb2 assumes. Instead
it starts with 'chan'. The really surprising thing is that this didn't cause
more problems sooner.
The patch below fixes this KASAN error. Whether it also fixes the original
error you found is something you need to test, but I think that's very likely.
Regards,
Hans
diff --git a/drivers/staging/media/tegra/tegra-common.h b/drivers/staging/media/tegra/tegra-common.h
index 79ec550c6f27..3980a8759e68 100644
--- a/drivers/staging/media/tegra/tegra-common.h
+++ b/drivers/staging/media/tegra/tegra-common.h
@@ -221,9 +221,9 @@ struct tegra_vi_channel {
* @mw_ack_sp_thresh: MW_ACK_DONE syncpoint threshold
*/
struct tegra_channel_buffer {
- struct tegra_vi_channel *chan;
struct vb2_v4l2_buffer buf;
struct list_head queue;
+ struct tegra_vi_channel *chan;
dma_addr_t addr;
u32 mw_ack_sp_thresh;
};
>
>
> [ 54.041421] tegra_channel_buffer_prepare+0x34/0x88
> [ 54.047666] __buf_prepare+0x1c4/0x230
> [ 54.052094] vb2_core_qbuf+0x454/0x508
> [ 54.056434] __vb2_init_fileio+0x1f8/0x2b8
> [ 54.060519] __vb2_perform_fileio+0x5a0/0x6b8
> [ 54.064864] vb2_read+0x10/0x18
> [ 54.067996] vb2_fop_read+0xb0/0xf8
> [ 54.071475] v4l2_read+0x74/0xb8
> [ 54.074697] __vfs_read+0x18/0x40
> [ 54.078003] vfs_read+0x98/0x168
> [ 54.081222] ksys_read+0x64/0xf0
> [ 54.084439] __arm64_sys_read+0x14/0x20
> [ 54.088268] el0_svc_common.constprop.2+0xb0/0x168
> [ 54.093047] do_el0_svc_compat+0x18/0x38
> [ 54.096961] el0_sync_compat_handler+0x13c/0x194
> [ 54.101565] el0_sync_compat+0x144/0x180
> [ 54.105478] Code: b9407802 eb02007f 540001e8 b9007404 (f81f8001)
> [ 54.111559] ---[ end trace 7fbb77a9700492f1 ]---
>
>>>
>>>> [ 41.222012] Mem abort info:
>>>> [ 41.224807] ESR = 0x9600004f
>>>> [ 41.227852] EC = 0x25: DABT (current EL), IL = 32 bits
>>>> [ 41.233160] SET = 0, FnV = 0
>>>> [ 41.236204] EA = 0, S1PTW = 0
>>>> [ 41.239344] Data abort info:
>>>> [ 41.242225] ISV = 0, ISS = 0x0000004f
>>>> [ 41.246058] CM = 0, WnR = 1
>>>> [ 41.249026] swapper pgtable: 4k pages, 48-bit VAs,
>>>> pgdp=0000000081498000
>>>> [ 41.255733] [ffff0000f5c3fff8] pgd=000000017f1f8003,
>>>> pud=000000017ec06003, pmd=000000017ea57003, pte=0060000175c3f793
>>>> [ 41.266345] Internal error: Oops: 9600004f [#1] PREEMPT SMP
>>>> [ 41.271905] Modules linked in: panel_simple tegra_drm
>>>> snd_hda_codec_hdmi snd_hda_tegra crct10dif_ce snd_hda_codec cec
>>>> drm_kms_helper snd_hda_core lp855x_bl drm pwm_tegra ip_tables x_tables
>>>> ipv6 nf_defrag_ipv6
>>>> [ 41.290401] CPU: 3 PID: 532 Comm: v4l2-compliance Tainted: G
>>>> W 5.6.0-rc1-00035-g6a105c1c479a-dirty #1
>>>> [ 41.300902] Hardware name: NVIDIA Jetson TX1 Developer Kit (DT)
>>>> [ 41.306807] pstate: 60000005 (nZCv daif -PAN -UAO)
>>>> [ 41.311593] pc : tegra_channel_buffer_prepare+0x34/0x88
>>>> [ 41.316807] lr : __buf_prepare+0x1c4/0x230
>>>> [ 41.320891] sp : ffff800011f5baa0
>>>> [ 41.324195] x29: ffff800011f5baa0 x28: ffff0000f58cc100
>>>> [ 41.329494] x27: ffff800011f5bc58 x26: ffff80001100b780
>>>> [ 41.334792] x25: ffff0000f81f1608 x24: ffff0000f7be7c00
>>>> [ 41.340091] x23: 00000000c058565d x22: 0000000000000000
>>>> [ 41.345390] x21: ffff0000f81f16e8 x20: 0000000000000000
>>>> [ 41.350688] x19: ffff0000f5c40000 x18: 0000000000000000
>>>> [ 41.355986] x17: 0000000000000000 x16: 0000000000000000
>>>> [ 41.361285] x15: ffff0000f8553800 x14: 0000000000000000
>>>> [ 41.366583] x13: 003f480000000000 x12: 003f500000000000
>>>> [ 41.371881] x11: 0000000100000000 x10: 0000000000000000
>>>> [ 41.377180] x9 : 0000000000000000 x8 : ffff0000f5c40258
>>>> [ 41.382478] x7 : 0000000000000030 x6 : 0000000000000001
>>>> [ 41.387776] x5 : 0000000000000000 x4 : 00000000003f4800
>>>> [ 41.393074] x3 : 00000000003f4800 x2 : 00000000003f4800
>>>> [ 41.398373] x1 : ffff0000f81f1080 x0 : ffff0000f5c40000
>>>> [ 41.403671] Call trace:
>>>> [ 41.406109] tegra_channel_buffer_prepare+0x34/0x88
>>>> [ 41.410974] __buf_prepare+0x1c4/0x230
>>>> [ 41.414713] vb2_core_prepare_buf+0x94/0x110
>>>> [ 41.418971] vb2_prepare_buf+0x74/0xa8
>>>> [ 41.422710] vb2_ioctl_prepare_buf+0x54/0x60
>>>> [ 41.426970] v4l_prepare_buf+0x44/0x58
>>>> [ 41.430707] __video_do_ioctl+0x228/0x3e8
>>>> [ 41.434705] video_usercopy+0x1cc/0x4d0
>>>> [ 41.438531] video_ioctl2+0x14/0x20
>>>> [ 41.442010] v4l2_ioctl+0x44/0x68
>>>> [ 41.445316] v4l2_compat_ioctl32+0x21c/0x1420
>>>> [ 41.449665] __arm64_compat_sys_ioctl+0xc8/0x108
>>>> [ 41.454273] el0_svc_common.constprop.2+0xb0/0x168
>>>> [ 41.459051] do_el0_svc_compat+0x18/0x38
>>>> [ 41.462964] el0_sync_compat_handler+0x13c/0x194
>>>> [ 41.467570] el0_sync_compat+0x144/0x180
>>>> [ 41.471483] Code: b9407802 eb02007f 540001e8 b9007404 (f81f8001)
>>>> [ 41.477563] ---[ end trace 051c84051f60870a ]---
>>>>
>>>>>>>>>> With using minimum 3 buffers, this issue doesnt happen at all
>>>>>>>>>> from
>>>>>>>>>> almost 72 hours of testing.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Will try with setting vb2 queue field min_buffers_needed as 3
>>>>>>>>>> instead
>>>>>>>>>> of adding check in queue setup.
>>>>>>>>>>
>>>>>>>>>>>> +
>>>>>>>>>>>> + return 0;
>>>>>>>>>>>> +}
^ permalink raw reply related
* [Buildroot] [PATCH 1/1] package/meson: fix pkg-config --static
From: Arnout Vandecappelle @ 2020-02-20 9:29 UTC (permalink / raw)
To: buildroot
In-Reply-To: <20200215152620.3553021-1-fontaine.fabrice@gmail.com>
On 15/02/2020 16:26, Fabrice Fontaine wrote:
> pkg-config wrapper is not used since commit
> 4e0bc29993376613d200e892d491e31ea5a49622, this raise static build
> failures with libglib2 because --static is not passed anymore to
> pkg-config so add a patch to get back the old behaviour.
>
> Fixes:
> - http://autobuild.buildroot.org/results/0d36952def63cb69628697fa6408aeb6ce10cb5b
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> ...dencies-base.py-add-pkg_config_stati.patch | 38 +++++++++++++++++++
> package/meson/cross-compilation.conf.in | 1 +
> package/pkg-meson.mk | 1 +
> 3 files changed, 40 insertions(+)
> create mode 100644 package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
>
> diff --git a/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch b/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> new file mode 100644
> index 0000000000..7bb00f3fba
> --- /dev/null
> +++ b/package/meson/0004-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> @@ -0,0 +1,38 @@
> +From 3a4962ede0d12bac66b38e0843f6e2ea75b03d50 Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Sat, 15 Feb 2020 15:13:59 +0100
> +Subject: [PATCH] mesonbuild/dependencies/base.py: add pkg_config_static
> +
> +Allow the user to always call pkg-config with --static thanks to a
> +pkg_config_static property. This will allow to fix static build failures
> +with libglib2:
> +
> +FAILED: gio/gio
> +/home/naourr/work/instance-0/output-1/host/bin/arm-linux-gcc -o gio/gio 'gio/6ae6c9e@@gio at exe/gio-tool.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-cat.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-copy.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-info.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-list.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mime.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mkdir.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-monitor.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-mount.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-move.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-open.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-rename.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-remove.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-save.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-set.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-trash.c.o' 'gio/6ae6c9e@@gio at exe/gio-tool-tree.c.o' -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -static -Wl,--start-group gio/libgio-2.0.a glib/libglib-2.0.a gobject/libgobject-2.0.a gmodule/libgmodule-2.0.a -pthread /home/naourr/work/instance-0/output-1/host/arm-build
> root-linux-uclibcgnueabi/sysroot/usr/lib/libz.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpcre.a -lm /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libffi.a -Wl,--end-group '-Wl,-rpath,$ORIGIN/:$ORIGIN/../glib:$ORIGIN/../gobject:$ORIGIN/../gmodule' -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gio -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/glib -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gobject -Wl,-rpath-link,/home/naourr/work/instance-0/output-1/build/libglib2-2.62.4/build/gmodule
> +/home/naourr/work/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmount.a(la-fs.o): in function `__mnt_fs_set_source_ptr':
> +fs.c:(.text+0x5ec): undefined reference to `blkid_parse_tag_string'
> +
> +Fixes:
> + - http://autobuild.buildroot.org/results/0d36952def63cb69628697fa6408aeb6ce10cb5b
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + mesonbuild/dependencies/base.py | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
> +index a83e3d6c..913bff6b 100644
> +--- a/mesonbuild/dependencies/base.py
> ++++ b/mesonbuild/dependencies/base.py
> +@@ -840,7 +840,7 @@ class PkgConfigDependency(ExternalDependency):
> + def _set_libs(self):
> + env = None
> + libcmd = [self.name, '--libs']
> +- if self.static:
> ++ if self.static or self.env.properties[self.for_machine].get('pkg_config_static', False):
Looks OK-ish to me, *if* we can get it accepted upstream. As is, it probably
won't get accepted because it misses a documentation update.
Maybe we should go upstream and ask advice...
Regards,
Arnout
> + libcmd.append('--static')
> + # Force pkg-config to output -L fields even if they are system
> + # paths so we can do manual searching with cc.find_library() later.
> +--
> +2.24.1
> +
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> index 369e225b3e..d80c472de6 100644
> --- a/package/meson/cross-compilation.conf.in
> +++ b/package/meson/cross-compilation.conf.in
> @@ -18,6 +18,7 @@ cpp_args = [@TARGET_CXXFLAGS@]
> cpp_link_args = [@TARGET_LDFLAGS@]
> sys_root = '@STAGING_DIR@'
> pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
> +pkg_config_static = '@STATIC@'
>
> [host_machine]
> system = 'linux'
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 642b715938..9482845cd3 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -76,6 +76,7 @@ define $(2)_CONFIGURE_CMDS
> -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
> -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
> -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
> + -e 's%@STATIC@%$$(if $$(BR2_STATIC_LIBS),true,false)%g' \
> $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
> -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
> ) \
>
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: remove Felix Fietkau for the Mediatek ethernet driver
From: Russell King - ARM Linux admin @ 2020-02-20 9:28 UTC (permalink / raw)
To: Felix Fietkau
Cc: Jakub Kicinski, John Crispin, Sean Wang, Mark Lee,
David S. Miller, netdev
In-Reply-To: <6ec21622-f9fe-8cf9-0464-7f5e4bb0a47e@nbd.name>
On Thu, Feb 20, 2020 at 09:54:44AM +0100, Felix Fietkau wrote:
> On 2020-02-18 21:00, Jakub Kicinski wrote:
> > On Tue, 18 Feb 2020 10:40:01 +0000 Russell King wrote:
> >> Felix's address has been failing for a while now with the following
> >> non-delivery report:
> >>
> >> This message was created automatically by mail delivery software.
> >>
> >> A message that you sent could not be delivered to one or more of its
> >> recipients. This is a permanent error. The following address(es) failed:
> >>
> >> nbd@openwrt.org
> >> host util-01.infra.openwrt.org [2a03:b0c0:3:d0::175a:2001]
> >> SMTP error from remote mail server after RCPT TO:<nbd@openwrt.org>:
> >> 550 Unrouteable address
> >>
> >> Let's remove his address from MAINTAINERS. If a different resolution
> >> is desired, please submit an alternative patch.
> >>
> >> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> >> ---
> >> MAINTAINERS | 1 -
> >> 1 file changed, 1 deletion(-)
> >>
> >> diff --git a/MAINTAINERS b/MAINTAINERS
> >> index a0d86490c2c6..82dccd29b24f 100644
> >> --- a/MAINTAINERS
> >> +++ b/MAINTAINERS
> >> @@ -10528,7 +10528,6 @@ F: drivers/leds/leds-mt6323.c
> >> F: Documentation/devicetree/bindings/leds/leds-mt6323.txt
> >>
> >> MEDIATEK ETHERNET DRIVER
> >> -M: Felix Fietkau <nbd@openwrt.org>
> >> M: John Crispin <john@phrozen.org>
> >> M: Sean Wang <sean.wang@mediatek.com>
> >> M: Mark Lee <Mark-MC.Lee@mediatek.com>
> >
> > Let's CC Felix, I think he's using nbd@nbd.name these days.
> Yes, my address should simply be changed to nbd@nbd.name.
Please send a patch to that effect.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
^ permalink raw reply
* Re: [RFC PATCH v3 4/6] media: tegra: Add Tegra210 Video input driver
From: Hans Verkuil @ 2020-02-20 9:29 UTC (permalink / raw)
To: Sowjanya Komatineni, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
jonathanh-DDmLM1+adcrQT0dZR+AlfA, frankc-DDmLM1+adcrQT0dZR+AlfA,
helen.koike-ZGY8ohtN/8qB+jHODAdFcQ, sboyd-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-clk-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <3adacc07-7e3a-2d06-8d18-003b004ede17-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 2/20/20 1:09 AM, Sowjanya Komatineni wrote:
>> Thanks Hans. Probably dma address is not aligned properly. Will check.
>
>
> I see this time repro happened right on power up during 1st run of
> compliance test and it shows kernel write to read-only error right
> during vb2_core_qbuf -> buf_prepare.
>
> it happened after buffers allocation and during pre-queuing of buffers
> right before starting 1st stream on power up.
>
> Hi Thierry,
>
> Currently tegra vi driver don't use iommu. Could this be some issue with
> contig allocation as iommu is not being used?
Nothing to do with that. The root cause is that struct tegra_channel_buffer
must start with struct vb2_v4l2_buffer since that's what vb2 assumes. Instead
it starts with 'chan'. The really surprising thing is that this didn't cause
more problems sooner.
The patch below fixes this KASAN error. Whether it also fixes the original
error you found is something you need to test, but I think that's very likely.
Regards,
Hans
diff --git a/drivers/staging/media/tegra/tegra-common.h b/drivers/staging/media/tegra/tegra-common.h
index 79ec550c6f27..3980a8759e68 100644
--- a/drivers/staging/media/tegra/tegra-common.h
+++ b/drivers/staging/media/tegra/tegra-common.h
@@ -221,9 +221,9 @@ struct tegra_vi_channel {
* @mw_ack_sp_thresh: MW_ACK_DONE syncpoint threshold
*/
struct tegra_channel_buffer {
- struct tegra_vi_channel *chan;
struct vb2_v4l2_buffer buf;
struct list_head queue;
+ struct tegra_vi_channel *chan;
dma_addr_t addr;
u32 mw_ack_sp_thresh;
};
>
>
> [ 54.041421] tegra_channel_buffer_prepare+0x34/0x88
> [ 54.047666] __buf_prepare+0x1c4/0x230
> [ 54.052094] vb2_core_qbuf+0x454/0x508
> [ 54.056434] __vb2_init_fileio+0x1f8/0x2b8
> [ 54.060519] __vb2_perform_fileio+0x5a0/0x6b8
> [ 54.064864] vb2_read+0x10/0x18
> [ 54.067996] vb2_fop_read+0xb0/0xf8
> [ 54.071475] v4l2_read+0x74/0xb8
> [ 54.074697] __vfs_read+0x18/0x40
> [ 54.078003] vfs_read+0x98/0x168
> [ 54.081222] ksys_read+0x64/0xf0
> [ 54.084439] __arm64_sys_read+0x14/0x20
> [ 54.088268] el0_svc_common.constprop.2+0xb0/0x168
> [ 54.093047] do_el0_svc_compat+0x18/0x38
> [ 54.096961] el0_sync_compat_handler+0x13c/0x194
> [ 54.101565] el0_sync_compat+0x144/0x180
> [ 54.105478] Code: b9407802 eb02007f 540001e8 b9007404 (f81f8001)
> [ 54.111559] ---[ end trace 7fbb77a9700492f1 ]---
>
>>>
>>>> [ 41.222012] Mem abort info:
>>>> [ 41.224807] ESR = 0x9600004f
>>>> [ 41.227852] EC = 0x25: DABT (current EL), IL = 32 bits
>>>> [ 41.233160] SET = 0, FnV = 0
>>>> [ 41.236204] EA = 0, S1PTW = 0
>>>> [ 41.239344] Data abort info:
>>>> [ 41.242225] ISV = 0, ISS = 0x0000004f
>>>> [ 41.246058] CM = 0, WnR = 1
>>>> [ 41.249026] swapper pgtable: 4k pages, 48-bit VAs,
>>>> pgdp=0000000081498000
>>>> [ 41.255733] [ffff0000f5c3fff8] pgd=000000017f1f8003,
>>>> pud=000000017ec06003, pmd=000000017ea57003, pte=0060000175c3f793
>>>> [ 41.266345] Internal error: Oops: 9600004f [#1] PREEMPT SMP
>>>> [ 41.271905] Modules linked in: panel_simple tegra_drm
>>>> snd_hda_codec_hdmi snd_hda_tegra crct10dif_ce snd_hda_codec cec
>>>> drm_kms_helper snd_hda_core lp855x_bl drm pwm_tegra ip_tables x_tables
>>>> ipv6 nf_defrag_ipv6
>>>> [ 41.290401] CPU: 3 PID: 532 Comm: v4l2-compliance Tainted: G
>>>> W 5.6.0-rc1-00035-g6a105c1c479a-dirty #1
>>>> [ 41.300902] Hardware name: NVIDIA Jetson TX1 Developer Kit (DT)
>>>> [ 41.306807] pstate: 60000005 (nZCv daif -PAN -UAO)
>>>> [ 41.311593] pc : tegra_channel_buffer_prepare+0x34/0x88
>>>> [ 41.316807] lr : __buf_prepare+0x1c4/0x230
>>>> [ 41.320891] sp : ffff800011f5baa0
>>>> [ 41.324195] x29: ffff800011f5baa0 x28: ffff0000f58cc100
>>>> [ 41.329494] x27: ffff800011f5bc58 x26: ffff80001100b780
>>>> [ 41.334792] x25: ffff0000f81f1608 x24: ffff0000f7be7c00
>>>> [ 41.340091] x23: 00000000c058565d x22: 0000000000000000
>>>> [ 41.345390] x21: ffff0000f81f16e8 x20: 0000000000000000
>>>> [ 41.350688] x19: ffff0000f5c40000 x18: 0000000000000000
>>>> [ 41.355986] x17: 0000000000000000 x16: 0000000000000000
>>>> [ 41.361285] x15: ffff0000f8553800 x14: 0000000000000000
>>>> [ 41.366583] x13: 003f480000000000 x12: 003f500000000000
>>>> [ 41.371881] x11: 0000000100000000 x10: 0000000000000000
>>>> [ 41.377180] x9 : 0000000000000000 x8 : ffff0000f5c40258
>>>> [ 41.382478] x7 : 0000000000000030 x6 : 0000000000000001
>>>> [ 41.387776] x5 : 0000000000000000 x4 : 00000000003f4800
>>>> [ 41.393074] x3 : 00000000003f4800 x2 : 00000000003f4800
>>>> [ 41.398373] x1 : ffff0000f81f1080 x0 : ffff0000f5c40000
>>>> [ 41.403671] Call trace:
>>>> [ 41.406109] tegra_channel_buffer_prepare+0x34/0x88
>>>> [ 41.410974] __buf_prepare+0x1c4/0x230
>>>> [ 41.414713] vb2_core_prepare_buf+0x94/0x110
>>>> [ 41.418971] vb2_prepare_buf+0x74/0xa8
>>>> [ 41.422710] vb2_ioctl_prepare_buf+0x54/0x60
>>>> [ 41.426970] v4l_prepare_buf+0x44/0x58
>>>> [ 41.430707] __video_do_ioctl+0x228/0x3e8
>>>> [ 41.434705] video_usercopy+0x1cc/0x4d0
>>>> [ 41.438531] video_ioctl2+0x14/0x20
>>>> [ 41.442010] v4l2_ioctl+0x44/0x68
>>>> [ 41.445316] v4l2_compat_ioctl32+0x21c/0x1420
>>>> [ 41.449665] __arm64_compat_sys_ioctl+0xc8/0x108
>>>> [ 41.454273] el0_svc_common.constprop.2+0xb0/0x168
>>>> [ 41.459051] do_el0_svc_compat+0x18/0x38
>>>> [ 41.462964] el0_sync_compat_handler+0x13c/0x194
>>>> [ 41.467570] el0_sync_compat+0x144/0x180
>>>> [ 41.471483] Code: b9407802 eb02007f 540001e8 b9007404 (f81f8001)
>>>> [ 41.477563] ---[ end trace 051c84051f60870a ]---
>>>>
>>>>>>>>>> With using minimum 3 buffers, this issue doesnt happen at all
>>>>>>>>>> from
>>>>>>>>>> almost 72 hours of testing.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Will try with setting vb2 queue field min_buffers_needed as 3
>>>>>>>>>> instead
>>>>>>>>>> of adding check in queue setup.
>>>>>>>>>>
>>>>>>>>>>>> +
>>>>>>>>>>>> + return 0;
>>>>>>>>>>>> +}
^ permalink raw reply related
* Re: [PATCH 1/2] vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
From: Miguel Ojeda @ 2020-02-20 9:28 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
clang-built-linux, sparclinux, Andy Lutomirski, Borislav Petkov,
David S. Miller, H. Peter Anvin, linux-kernel
In-Reply-To: <20200220071140.14080-1-masahiroy@kernel.org>
On Thu, Feb 20, 2020 at 8:12 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> It it about two years since 28128c61e08e. Nobody has reported a
Nit: "It it" -> "it is"
> It is ugly and unreliable to attempt to undefine a CONFIG option from
> C files, and anyway the inlining heuristic is up to the compiler.
+1
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cheers,
Miguel
^ permalink raw reply
* [PATCH] iio: amplifiers: ad8366: add support for HMC1119 Attenuator
From: Sergiu @ 2020-02-20 9:28 UTC (permalink / raw)
To: linux-iio, linux-kernel; +Cc: jic23, Sergiu
This change adds support for the HMC1119 Silicon Digial Attenuator. The
HMC1119 is a broadband, highly accurate, 7-bit digital attenuator,
operating from 0.1 GHz to 6.0 GHz with 31.5 dB attenuation control range
in 0.25 dB steps.
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/hmc1119.pdf
Signed-off-by: Sergiu <sergiu.cuciurean@analog.com>
---
drivers/iio/amplifiers/ad8366.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 95972ab60f42..62167b87caea 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -5,6 +5,7 @@
* AD8366 Dual-Digital Variable Gain Amplifier (VGA)
* ADA4961 BiCMOS RF Digital Gain Amplifier (DGA)
* ADL5240 Digitally controlled variable gain amplifier (VGA)
+ * HMC1119 0.25 dB LSB, 7-Bit, Silicon Digital Attenuator
*
* Copyright 2012-2019 Analog Devices Inc.
*/
@@ -27,6 +28,7 @@ enum ad8366_type {
ID_AD8366,
ID_ADA4961,
ID_ADL5240,
+ ID_HMC1119,
};
struct ad8366_info {
@@ -62,6 +64,10 @@ static struct ad8366_info ad8366_infos[] = {
.gain_min = -11500,
.gain_max = 20000,
},
+ [ID_HMC1119] = {
+ .gain_min = -31750,
+ .gain_max = 0,
+ },
};
static int ad8366_write(struct iio_dev *indio_dev,
@@ -84,6 +90,9 @@ static int ad8366_write(struct iio_dev *indio_dev,
case ID_ADL5240:
st->data[0] = (ch_a & 0x3F);
break;
+ case ID_HMC1119:
+ st->data[0] = ch_a;
+ break;
}
ret = spi_write(st->spi, st->data, indio_dev->num_channels);
@@ -118,6 +127,9 @@ static int ad8366_read_raw(struct iio_dev *indio_dev,
case ID_ADL5240:
gain = 20000 - 31500 + code * 500;
break;
+ case ID_HMC1119:
+ gain = -1 * code * 250;
+ break;
}
/* Values in dB */
@@ -164,6 +176,9 @@ static int ad8366_write_raw(struct iio_dev *indio_dev,
case ID_ADL5240:
code = ((gain - 500 - 20000) / 500) & 0x3F;
break;
+ case ID_HMC1119:
+ code = (abs(gain) / 250) & 0x7F;
+ break;
}
mutex_lock(&st->lock);
@@ -246,6 +261,7 @@ static int ad8366_probe(struct spi_device *spi)
break;
case ID_ADA4961:
case ID_ADL5240:
+ case ID_HMC1119:
st->reset_gpio = devm_gpiod_get(&spi->dev, "reset",
GPIOD_OUT_HIGH);
indio_dev->channels = ada4961_channels;
@@ -298,6 +314,7 @@ static const struct spi_device_id ad8366_id[] = {
{"ad8366", ID_AD8366},
{"ada4961", ID_ADA4961},
{"adl5240", ID_ADL5240},
+ {"hmc1119", ID_HMC1119},
{}
};
MODULE_DEVICE_TABLE(spi, ad8366_id);
--
2.17.1
^ permalink raw reply related
* [PATCH] bootcounter: add DM support for memory based bootcounter
From: Heiko Schocher @ 2020-02-20 9:28 UTC (permalink / raw)
To: u-boot
add DM/DTS support for the memory based bootcounter
in drivers/bootcount/bootcount.c.
Let the old implementation in, so boards which have
not yet convert to DM/DTS do not break.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
Travis build:
https://travis-ci.org/hsdenx/u-boot-test/builds/652839618
doc/device-tree-bindings/misc/bootcounter.txt | 21 +++++
drivers/bootcount/Kconfig | 5 ++
drivers/bootcount/Makefile | 1 +
drivers/bootcount/bootcount.c | 86 +++++++++++++++++++
4 files changed, 113 insertions(+)
create mode 100644 doc/device-tree-bindings/misc/bootcounter.txt
diff --git a/doc/device-tree-bindings/misc/bootcounter.txt b/doc/device-tree-bindings/misc/bootcounter.txt
new file mode 100644
index 0000000000..f4a4a731b9
--- /dev/null
+++ b/doc/device-tree-bindings/misc/bootcounter.txt
@@ -0,0 +1,21 @@
+U-Boot bootcounter Devicetree Binding
+=====================================
+
+The device tree node describes the U-Boot bootcounter
+memory based device binding.
+
+Required properties :
+
+- compatible : "uboot,bootcount";
+- singleword : set this, if you have only one word space
+ for storing the bootcounter.
+
+Example
+-------
+
+MPC83xx based board:
+
+bootcount at 0x13ff8 {
+ compatible = "uboot,bootcount";
+ reg = <0x13ff8 0x08>;
+};
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index 0e506c9ea2..88203607a8 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -106,6 +106,11 @@ config DM_BOOTCOUNT_I2C_EEPROM
pointing to the underlying i2c eeprom device) and an optional 'offset'
property are supported.
+config BOOTCOUNT_MEM
+ bool "memory based bootcounter"
+ help
+ Memory based bootcount, compatible = "uboot,bootcount";
+
endmenu
endif
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
index 73ccfb5a08..059d40d16b 100644
--- a/drivers/bootcount/Makefile
+++ b/drivers/bootcount/Makefile
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+
obj-$(CONFIG_BOOTCOUNT_GENERIC) += bootcount.o
+obj-$(CONFIG_BOOTCOUNT_MEM) += bootcount.o
obj-$(CONFIG_BOOTCOUNT_AT91) += bootcount_at91.o
obj-$(CONFIG_BOOTCOUNT_AM33XX) += bootcount_davinci.o
obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o
diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c
index 7a6d03dcca..53bd416cf6 100644
--- a/drivers/bootcount/bootcount.c
+++ b/drivers/bootcount/bootcount.c
@@ -8,6 +8,7 @@
#include <cpu_func.h>
#include <linux/compiler.h>
+#if !defined(CONFIG_DM_BOOTCOUNT)
/* Now implement the generic default functions */
__weak void bootcount_store(ulong a)
{
@@ -49,3 +50,88 @@ __weak ulong bootcount_load(void)
return raw_bootcount_load(reg);
#endif /* defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) */
}
+#else
+#include <dm.h>
+
+struct bootcount_mem_priv {
+ phys_addr_t base;
+ u8 singleword;
+};
+
+static int bootcount_mem_get(struct udevice *dev, u32 *a)
+{
+ struct bootcount_mem_priv *priv = dev_get_priv(dev);
+ void *reg = (void *)priv->base;
+ u32 magic = CONFIG_SYS_BOOTCOUNT_MAGIC;
+
+ if (priv->singleword) {
+ u32 tmp = raw_bootcount_load(reg);
+
+ if ((tmp & 0xffff0000) != (magic & 0xffff0000))
+ return -ENODEV;
+
+ *a = (tmp & 0x0000ffff);
+ } else {
+ if (raw_bootcount_load(reg + 4) != magic)
+ return -ENODEV;
+
+ *a = raw_bootcount_load(reg);
+ }
+
+ return 0;
+};
+
+static int bootcount_mem_set(struct udevice *dev, const u32 a)
+{
+ struct bootcount_mem_priv *priv = dev_get_priv(dev);
+ void *reg = (void *)priv->base;
+ u32 magic = CONFIG_SYS_BOOTCOUNT_MAGIC;
+ uintptr_t flush_start = rounddown(priv->base,
+ CONFIG_SYS_CACHELINE_SIZE);
+ uintptr_t flush_end;
+
+ if (priv->singleword) {
+ raw_bootcount_store(reg, (magic & 0xffff0000) | a);
+ flush_end = roundup(priv->base + 4,
+ CONFIG_SYS_CACHELINE_SIZE);
+ } else {
+ raw_bootcount_store(reg, a);
+ raw_bootcount_store(reg + 4, magic);
+ flush_end = roundup(priv->base + 8,
+ CONFIG_SYS_CACHELINE_SIZE);
+ }
+ flush_dcache_range(flush_start, flush_end);
+
+ return 0;
+};
+
+static const struct bootcount_ops bootcount_mem_ops = {
+ .get = bootcount_mem_get,
+ .set = bootcount_mem_set,
+};
+
+static int bootcount_mem_probe(struct udevice *dev)
+{
+ struct bootcount_mem_priv *priv = dev_get_priv(dev);
+
+ priv->base = (phys_addr_t)devfdt_get_addr(dev);
+ priv->singleword = dev_read_u32_default(dev, "singleword", 0);
+
+ return 0;
+}
+
+static const struct udevice_id bootcount_mem_ids[] = {
+ { .compatible = "uboot,bootcount" },
+ { .compatible = "u-boot,bootcount" },
+ { }
+};
+
+U_BOOT_DRIVER(bootcount_mem) = {
+ .name = "bootcount-mem",
+ .id = UCLASS_BOOTCOUNT,
+ .priv_auto_alloc_size = sizeof(struct bootcount_mem_priv),
+ .probe = bootcount_mem_probe,
+ .of_match = bootcount_mem_ids,
+ .ops = &bootcount_mem_ops,
+};
+#endif
--
2.24.1
^ permalink raw reply related
* [PULL 10/13] linux-user: Add support for getting/setting specified alsa timer parameters using ioctls
From: Laurent Vivier @ 2020-02-20 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Riku Voipio, Laurent Vivier, Filip Bozuta, Aleksandar Markovic,
Aleksandar Rikalo, Aurelien Jarno
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>
From: Filip Bozuta <Filip.Bozuta@rt-rk.com>
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_GINFO - Getting information about specified timer
Read information about the specified timer. The information about the
timer is returned in the following structure:
struct snd_timer_ginfo {
struct snd_timer_id tid; /* requested timer ID */
unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
int card; /* card number */
unsigned char id[64]; /* timer identification */
unsigned char name[80]; /* timer name */
unsigned long reserved0; /* reserved for future use */
unsigned long resolution; /* average period resolution in ns */
unsigned long resolution_min; /* minimal period resolution in ns */
unsigned long resolution_max; /* maximal period resolution in ns */
unsigned int clients; /* active timer clients */
unsigned char reserved[32]; /* reserved */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which information is to be obtained. After the
ioctl call, the rest of the structure fields are filled with values from
the timer device with the specified id. If there is no device with the
specified id, the error ENODEV ("No such device") is returned.
SNDRV_TIMER_IOCTL_GPARAMS - Setting precise period duration
Sets timer precise period duration numerator and denominator in seconds. The
period duration is set in the following structure:
struct snd_timer_gparams {
struct snd_timer_id tid; /* requested timer ID */
unsigned long period_num; /* period duration - numerator */
unsigned long period_den; /* period duration - denominator */
unsigned char reserved[32]; /* reserved */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which period duration is to be set. Also, the
fileds "period_num" and "period_den" should be filled with the period
duration numerator and denominator values that are to be set respectively.
If there is no device with the specified id, the error ENODEV ("No such
device") is returned.
SNDRV_TIMER_IOCTL_GSTATUS - Getting current period resolution
Read timer current period resolution in nanoseconds and period resolution
numerator and denominator in seconds. The period resolution information is
returned in the following structure:
struct snd_timer_gstatus {
struct snd_timer_id tid; /* requested timer ID */
unsigned long resolution; /* current period resolution in ns */
unsigned long resolution_num; /* period resolution - numerator */
unsigned long resolution_den; /* period resolution - denominator */
unsigned char reserved[32]; /* reserved for future use */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which period resolution is to be obtained. After
the ioctl call, the rest of the structure fields are filled with values
from the timer device with the specified id. If there is no device with the
specified id, the error ENODEV ("No such device") is returned.
Implementation notes:
All ioctls in this patch have pointer to some kind of a structure as their
third argument. That is the reason why corresponding definitions were added
in 'linux-user/syscall_types.h'. All of these strcutures have some fields
that are of type 'unsigned long'. That is the reason why separate target
structures were defined in 'linux-user/syscall_defs.h'. Also, all of the
structures have a field with type 'struct snd_timer_id' which is the reason
why a separate target structure 'struct target_snd_timer_id' was also
defined. The rest of the implementation was straightforward.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-10-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 6 ++++++
linux-user/syscall_defs.h | 43 ++++++++++++++++++++++++++++++++++++++
linux-user/syscall_types.h | 26 +++++++++++++++++++++++
3 files changed, 75 insertions(+)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 950e99617dcc..150aa680b018 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -464,6 +464,12 @@
IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_id)))
+ IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo)))
+ IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
+ IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index eb00358b5437..c714e8b67b6e 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2437,10 +2437,53 @@ struct target_statfs64 {
#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
+struct target_snd_timer_id {
+ int dev_class;
+ int dev_sclass;
+ int card;
+ int device;
+ int subdevice;
+};
+
+struct target_snd_timer_ginfo {
+ struct target_snd_timer_id tid;
+ unsigned int flags;
+ int card;
+ unsigned char id[64];
+ unsigned char name[80];
+ abi_ulong reserved0;
+ abi_ulong resolution;
+ abi_ulong resolution_min;
+ abi_ulong resolution_max;
+ unsigned int clients;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gparams {
+ struct target_snd_timer_id tid;
+ abi_ulong period_num;
+ abi_ulong period_den;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gstatus {
+ struct target_snd_timer_id tid;
+ abi_ulong resolution;
+ abi_ulong resolution_num;
+ abi_ulong resolution_den;
+ unsigned char reserved[32];
+};
+
/* alsa timer ioctls */
#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int)
#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \
struct snd_timer_id)
+#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \
+ struct target_snd_timer_ginfo)
+#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \
+ struct target_snd_timer_gparams)
+#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \
+ struct target_snd_timer_gstatus)
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 4c3a65cfc030..adcfa2822468 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -90,6 +90,32 @@ STRUCT(snd_timer_id,
TYPE_INT, /* device */
TYPE_INT) /* subdevice */
+STRUCT(snd_timer_ginfo,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* card */
+ MK_ARRAY(TYPE_CHAR, 64), /* id */
+ MK_ARRAY(TYPE_CHAR, 80), /* name */
+ TYPE_ULONG, /* reserved0 */
+ TYPE_ULONG, /* resolution */
+ TYPE_ULONG, /* resolution_min */
+ TYPE_ULONG, /* resolution_max */
+ TYPE_INT, /* clients */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_gparams,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_ULONG, /* period_num */
+ TYPE_ULONG, /* period_den */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_gstatus,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_ULONG, /* resolution */
+ TYPE_ULONG, /* resolution_num */
+ TYPE_ULONG, /* resolution_den */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
/* loop device ioctls */
STRUCT(loop_info,
TYPE_INT, /* lo_number */
--
2.24.1
^ permalink raw reply related
* Re: [PATCH 1/2] vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
From: Miguel Ojeda @ 2020-02-20 9:28 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
clang-built-linux, sparclinux, Andy Lutomirski, Borislav Petkov,
David S. Miller, H. Peter Anvin, linux-kernel
In-Reply-To: <20200220071140.14080-1-masahiroy@kernel.org>
On Thu, Feb 20, 2020 at 8:12 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> It it about two years since 28128c61e08e. Nobody has reported a
Nit: "It it" -> "it is"
> It is ugly and unreliable to attempt to undefine a CONFIG option from
> C files, and anyway the inlining heuristic is up to the compiler.
+1
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cheers,
Miguel
^ permalink raw reply
* [PULL 13/13] linux-user: Add support for selected alsa timer instructions using ioctls
From: Laurent Vivier @ 2020-02-20 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Riku Voipio, Laurent Vivier, Filip Bozuta, Aleksandar Markovic,
Aleksandar Rikalo, Aurelien Jarno
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>
From: Filip Bozuta <Filip.Bozuta@rt-rk.com>
This patch implements functionalities of following ioctls:
SNDRV_TIMER_IOCTL_START - Start selected alsa timer
Starts the timer device that is selected. The third ioctl's argument is
ignored. Before calling this ioctl, the ioctl "SNDRV_TIMER_IOCTL_SELECT"
should be called first to select the timer that is to be started. If no
timer is selected, the error EBADFD ("File descriptor in bad shape")
is returned.
SNDRV_TIMER_IOCTL_STOP - Stop selected alsa timer
Stops the timer device that is selected. The third ioctl's argument is
ignored. Before calling this ioctl, the ioctl "SNDRV_TIMER_IOCTL_SELECT"
should be called first to select the timer that is to be stopped. If no
timer is selected, the error EBADFD ("File descriptor in bad shape")
is returned.
SNDRV_TIMER_IOCTL_CONTINUE - Continue selected alsa timer
Continues the timer device that is selected. The third ioctl's argument is
ignored. Before calling this ioctl, the ioctl "SNDRV_TIMER_IOCTL_SELECT"
should be called first to select the timer that is to be continued. If no
timer is selected, the error EBADFD ("File descriptor in bad shape")
is returned.
SNDRV_TIMER_IOCTL_PAUSE - Pause selected alsa timer
Pauses the timer device that is selected. The third ioctl's argument is
ignored. Before calling this ioctl, the ioctl "SNDRV_TIMER_IOCTL_SELECT"
should be called first to select the timer that is to be paused. If no
timer is selected, the error EBADFD ("File descriptor in bad shape")
is returned.
Implementation notes:
Since all of the implemented ioctls have NULL as their third argument,
their implementation was straightforward.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-13-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 4 ++++
linux-user/syscall_defs.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index de6948796367..0defa1d8c18d 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -477,6 +477,10 @@
MK_PTR(MK_STRUCT(STRUCT_snd_timer_params)))
IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_status)))
+ IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL)
IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index cf34129fc3ac..152ec637cba6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2516,6 +2516,10 @@ struct target_snd_timer_status {
struct snd_timer_params)
#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \
struct target_snd_timer_status)
+#define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0)
+#define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1)
+#define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2)
+#define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3)
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
--
2.24.1
^ permalink raw reply related
* Re: [PATCH v2] Avoid address_space_rw() with a constant is_write argument
From: Philippe Mathieu-Daudé @ 2020-02-20 9:27 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Laurent Vivier, Thomas Huth, Cornelia Huck, Eduardo Habkost,
Alistair Francis, Halil Pasic, Christian Borntraeger,
Cédric Le Goater, Paolo Bonzini, Edgar E. Iglesias,
David Gibson
In-Reply-To: <f87dbeeb-2259-9eb9-45c7-a30819eec2ee@redhat.com>
On 2/18/20 1:56 PM, Philippe Mathieu-Daudé wrote:
> On 2/18/20 12:24 PM, Peter Maydell wrote:
>> The address_space_rw() function allows either reads or writes
>> depending on the is_write argument passed to it; this is useful
>> when the direction of the access is determined programmatically
>> (as for instance when handling the KVM_EXIT_MMIO exit reason).
>> Under the hood it just calls either address_space_write() or
>> address_space_read_full().
>>
>> We also use it a lot with a constant is_write argument, though,
>> which has two issues:
>> * when reading "address_space_rw(..., 1)" this is less
>> immediately clear to the reader as being a write than
>> "address_space_write(...)"
>> * calling address_space_rw() bypasses the optimization
>> in address_space_read() that fast-paths reads of a
>> fixed length
>>
>> This commit was produced with the included Coccinelle script
>> scripts/coccinelle/as-rw-const.patch.
Script is "scripts/coccinelle/as_rw_const.cocci".
I plan to respin this patch (fixed) in a larger series.
>>
>> Two lines in hw/net/dp8393x.c that Coccinelle produced that
>> were over 80 characters were re-wrapped by hand.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> I could break this down into separate patches by submaintainer,
>> but the patch is not that large and I would argue that it's
>> better for the project if we can try to avoid introducing too
>> much friction into the process of doing 'safe' tree-wide
>> minor refactorings.
>>
>> v1->v2: put the coccinelle script in scripts/coccinelle rather
>> than just in the commit message.
>> ---
>> accel/kvm/kvm-all.c | 6 +--
>> dma-helpers.c | 4 +-
>> exec.c | 4 +-
>> hw/dma/xlnx-zdma.c | 11 ++---
>> hw/net/dp8393x.c | 68 ++++++++++++++--------------
>> hw/net/i82596.c | 25 +++++-----
>> hw/net/lasi_i82596.c | 5 +-
>> hw/ppc/pnv_lpc.c | 8 ++--
>> hw/s390x/css.c | 12 ++---
>> qtest.c | 52 ++++++++++-----------
>> target/i386/hvf/x86_mmu.c | 12 ++---
>> scripts/coccinelle/as_rw_const.cocci | 30 ++++++++++++
>> 12 files changed, 133 insertions(+), 104 deletions(-)
>> create mode 100644 scripts/coccinelle/as_rw_const.cocci
^ permalink raw reply
* Re: [PATCH] docs: arm64: fix trivial spelling enought to enough in memory.rst
From: Will Deacon @ 2020-02-20 9:27 UTC (permalink / raw)
To: Scott Branden
Cc: Jiri Kosina, linux-doc, Catalin Marinas, Jonathan Corbet,
linux-kernel, linux-arm-kernel
In-Reply-To: <20200219221403.16740-1-scott.branden@broadcom.com>
On Wed, Feb 19, 2020 at 02:14:03PM -0800, Scott Branden wrote:
> Fix trivial spelling error enought to enough in memory.rst.
>
> Cc: trivial@kernel.org
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> ---
> Documentation/arm64/memory.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I can take this along with the other arm64 fixes I have pending.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] docs: arm64: fix trivial spelling enought to enough in memory.rst
From: Will Deacon @ 2020-02-20 9:27 UTC (permalink / raw)
To: Scott Branden
Cc: Catalin Marinas, Jonathan Corbet, Jiri Kosina, linux-arm-kernel,
linux-doc, linux-kernel
In-Reply-To: <20200219221403.16740-1-scott.branden@broadcom.com>
On Wed, Feb 19, 2020 at 02:14:03PM -0800, Scott Branden wrote:
> Fix trivial spelling error enought to enough in memory.rst.
>
> Cc: trivial@kernel.org
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> ---
> Documentation/arm64/memory.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I can take this along with the other arm64 fixes I have pending.
Will
^ permalink raw reply
* [PULL 06/13] linux-user: Use `qemu_log' for non-strace logging
From: Laurent Vivier @ 2020-02-20 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Riku Voipio, Laurent Vivier, Josh Kunz, Aleksandar Markovic,
Aleksandar Rikalo, Aurelien Jarno
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>
From: Josh Kunz <jkz@google.com>
Since most calls to `gemu_log` are actually logging unimplemented features,
this change replaces most non-strace calls to `gemu_log` with calls to
`qemu_log_mask(LOG_UNIMP, ...)`. This allows the user to easily log to
a file, and to mask out these log messages if they desire.
Note: This change is slightly backwards incompatible, since now these
"unimplemented" log messages will not be logged by default.
Signed-off-by: Josh Kunz <jkz@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200204025416.111409-2-jkz@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/arm/cpu_loop.c | 5 ++--
linux-user/fd-trans.c | 55 +++++++++++++++++++++++++--------------
linux-user/syscall.c | 35 ++++++++++++++++---------
linux-user/vm86.c | 3 ++-
4 files changed, 62 insertions(+), 36 deletions(-)
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index 1fae90c6dfc6..cf618daa1ca5 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -349,8 +349,9 @@ void cpu_loop(CPUARMState *env)
env->regs[0] = cpu_get_tls(env);
break;
default:
- gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
- n);
+ qemu_log_mask(LOG_UNIMP,
+ "qemu: Unsupported ARM syscall: 0x%x\n",
+ n);
env->regs[0] = -TARGET_ENOSYS;
break;
}
diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c
index 9b92386abf51..c0687c52e62b 100644
--- a/linux-user/fd-trans.c
+++ b/linux-user/fd-trans.c
@@ -514,7 +514,8 @@ static abi_long host_to_target_data_bridge_nlattr(struct nlattr *nlattr,
u32[1] = tswap32(u32[1]); /* optmask */
break;
default:
- gemu_log("Unknown QEMU_IFLA_BR type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BR type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -577,7 +578,8 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr,
case QEMU_IFLA_BRPORT_BRIDGE_ID:
break;
default:
- gemu_log("Unknown QEMU_IFLA_BRPORT type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BRPORT type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -605,7 +607,8 @@ static abi_long host_to_target_data_tun_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown QEMU_IFLA_TUN type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_TUN type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -652,7 +655,8 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_tun_nlattr);
} else {
- gemu_log("Unknown QEMU_IFLA_INFO_KIND %s\n", li_context->name);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_KIND %s\n",
+ li_context->name);
}
break;
case QEMU_IFLA_INFO_SLAVE_DATA:
@@ -663,12 +667,13 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_slave_data_bridge_nlattr);
} else {
- gemu_log("Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
li_context->slave_name);
}
break;
default:
- gemu_log("Unknown host QEMU_IFLA_INFO type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA_INFO type: %d\n",
+ nlattr->nla_type);
break;
}
@@ -690,7 +695,8 @@ static abi_long host_to_target_data_inet_nlattr(struct nlattr *nlattr,
}
break;
default:
- gemu_log("Unknown host AF_INET type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET type: %d\n",
+ nlattr->nla_type);
}
return 0;
}
@@ -741,7 +747,8 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr,
}
break;
default:
- gemu_log("Unknown host AF_INET6 type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET6 type: %d\n",
+ nlattr->nla_type);
}
return 0;
}
@@ -759,7 +766,8 @@ static abi_long host_to_target_data_spec_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_inet6_nlattr);
default:
- gemu_log("Unknown host AF_SPEC type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_SPEC type: %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -780,7 +788,8 @@ static abi_long host_to_target_data_xdp_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown host XDP type: %d\n", nlattr->nla_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host XDP type: %d\n", nlattr->nla_type);
break;
}
return 0;
@@ -920,7 +929,8 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
NULL,
host_to_target_data_xdp_nlattr);
default:
- gemu_log("Unknown host QEMU_IFLA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -954,7 +964,8 @@ static abi_long host_to_target_data_addr_rtattr(struct rtattr *rtattr)
ci->tstamp = tswap32(ci->tstamp);
break;
default:
- gemu_log("Unknown host IFA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host IFA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@@ -996,7 +1007,8 @@ static abi_long host_to_target_data_route_rtattr(struct rtattr *rtattr)
#endif
break;
default:
- gemu_log("Unknown host RTA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host RTA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@@ -1111,7 +1123,8 @@ static abi_long target_to_host_data_link_rtattr(struct rtattr *rtattr)
{
switch (rtattr->rta_type) {
default:
- gemu_log("Unknown target QEMU_IFLA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target QEMU_IFLA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1125,7 +1138,8 @@ static abi_long target_to_host_data_addr_rtattr(struct rtattr *rtattr)
case IFA_ADDRESS:
break;
default:
- gemu_log("Unknown target IFA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target IFA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1147,7 +1161,8 @@ static abi_long target_to_host_data_route_rtattr(struct rtattr *rtattr)
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown target RTA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target RTA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1232,8 +1247,8 @@ static abi_long host_to_target_data_audit(struct nlmsghdr *nlh)
{
switch (nlh->nlmsg_type) {
default:
- gemu_log("Unknown host audit message type %d\n",
- nlh->nlmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host audit message type %d\n",
+ nlh->nlmsg_type);
return -TARGET_EINVAL;
}
return 0;
@@ -1253,8 +1268,8 @@ static abi_long target_to_host_data_audit(struct nlmsghdr *nlh)
case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
break;
default:
- gemu_log("Unknown target audit message type %d\n",
- nlh->nlmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target audit message type %d\n",
+ nlh->nlmsg_type);
return -TARGET_EINVAL;
}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9fa722f2388d..16d98c1ff5ff 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1563,7 +1563,11 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
* something more intelligent than "twice the size of the
* target buffer we're reading from".
*/
- gemu_log("Host cmsg overflow\n");
+ qemu_log_mask(LOG_UNIMP,
+ ("Unsupported ancillary data %d/%d: "
+ "unhandled msg size\n"),
+ tswap32(target_cmsg->cmsg_level),
+ tswap32(target_cmsg->cmsg_type));
break;
}
@@ -1593,8 +1597,8 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
__get_user(cred->uid, &target_cred->uid);
__get_user(cred->gid, &target_cred->gid);
} else {
- gemu_log("Unsupported ancillary data: %d/%d\n",
- cmsg->cmsg_level, cmsg->cmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
+ cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(data, target_data, len);
}
@@ -1815,8 +1819,8 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
default:
unimplemented:
- gemu_log("Unsupported ancillary data: %d/%d\n",
- cmsg->cmsg_level, cmsg->cmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
+ cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(target_data, data, MIN(len, tgt_len));
if (tgt_len > len) {
memset(target_data + len, 0, tgt_len - len);
@@ -2291,7 +2295,8 @@ set_timeout:
#endif /* SOL_NETLINK */
default:
unimplemented:
- gemu_log("Unsupported setsockopt level=%d optname=%d\n", level, optname);
+ qemu_log_mask(LOG_UNIMP, "Unsupported setsockopt level=%d optname=%d\n",
+ level, optname);
ret = -TARGET_ENOPROTOOPT;
}
return ret;
@@ -2698,8 +2703,9 @@ get_timeout:
#endif /* SOL_NETLINK */
default:
unimplemented:
- gemu_log("getsockopt level=%d optname=%d not yet supported\n",
- level, optname);
+ qemu_log_mask(LOG_UNIMP,
+ "getsockopt level=%d optname=%d not yet supported\n",
+ level, optname);
ret = -TARGET_EOPNOTSUPP;
break;
}
@@ -3454,7 +3460,7 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
case TARGET_SYS_SENDMMSG: /* sockfd, msgvec, vlen, flags */
return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
default:
- gemu_log("Unsupported socketcall: %d\n", num);
+ qemu_log_mask(LOG_UNIMP, "Unsupported socketcall: %d\n", num);
return -TARGET_EINVAL;
}
}
@@ -4365,7 +4371,8 @@ static abi_long do_ipc(CPUArchState *cpu_env,
ret = do_shmctl(first, second, ptr);
break;
default:
- gemu_log("Unsupported ipc call: %d (version %d)\n", call, version);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ipc call: %d (version %d)\n",
+ call, version);
ret = -TARGET_ENOSYS;
break;
}
@@ -5213,7 +5220,8 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {
- gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
+ qemu_log_mask(
+ LOG_UNIMP, "Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
return -TARGET_ENOSYS;
}
if (ie->target_cmd == cmd)
@@ -5281,8 +5289,9 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
}
break;
default:
- gemu_log("Unsupported ioctl type: cmd=0x%04lx type=%d\n",
- (long)cmd, arg_type[0]);
+ qemu_log_mask(LOG_UNIMP,
+ "Unsupported ioctl type: cmd=0x%04lx type=%d\n",
+ (long)cmd, arg_type[0]);
ret = -TARGET_ENOSYS;
break;
}
diff --git a/linux-user/vm86.c b/linux-user/vm86.c
index 2fa7a89edc4e..4412522c4c4e 100644
--- a/linux-user/vm86.c
+++ b/linux-user/vm86.c
@@ -402,7 +402,8 @@ int do_vm86(CPUX86State *env, long subfunction, abi_ulong vm86_addr)
case TARGET_VM86_FREE_IRQ:
case TARGET_VM86_GET_IRQ_BITS:
case TARGET_VM86_GET_AND_RESET_IRQ:
- gemu_log("qemu: unsupported vm86 subfunction (%ld)\n", subfunction);
+ qemu_log_mask(LOG_UNIMP, "qemu: unsupported vm86 subfunction (%ld)\n",
+ subfunction);
ret = -TARGET_EINVAL;
goto out;
case TARGET_VM86_PLUS_INSTALL_CHECK:
--
2.24.1
^ permalink raw reply related
* [PULL 11/13] linux-user: Add support for selecting alsa timer using ioctl
From: Laurent Vivier @ 2020-02-20 9:20 UTC (permalink / raw)
To: qemu-devel
Cc: Riku Voipio, Laurent Vivier, Filip Bozuta, Aleksandar Markovic,
Aleksandar Rikalo, Aurelien Jarno
In-Reply-To: <20200220092053.1510215-1-laurent@vivier.eu>
From: Filip Bozuta <Filip.Bozuta@rt-rk.com>
This patch implements functionality of following ioctl:
SNDRV_TIMER_IOCTL_SELECT - Selecting timer
Selects the timer which id is specified. The timer id is specified in the
following strcuture:
struct snd_timer_select {
struct snd_timer_id id; /* timer ID */
unsigned char reserved[32]; /* reserved */
};
A pointer to this structure should be passed as the third ioctl's argument.
Before calling the ioctl, the field "tid" should be initialized with the id
information for the timer which is to be selected. If there is no timer
device with the specified id, the error ENODEV ("No such device") is
returned.
Implementation notes:
Ioctl implemented in this patch has a pointer to a
'struct snd_timer_select' as its third argument.
That is the reason why a corresponding definition
was added in 'linux-user/syscall_types.h'. The rest
of the implementation was straightforward.
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Message-Id: <1579117007-7565-11-git-send-email-Filip.Bozuta@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 2 ++
linux-user/syscall_defs.h | 7 +++++++
linux-user/syscall_types.h | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 150aa680b018..8313af3672c6 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -470,6 +470,8 @@
MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
+ IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c714e8b67b6e..cac9228a37d0 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2474,6 +2474,11 @@ struct target_snd_timer_gstatus {
unsigned char reserved[32];
};
+struct target_snd_timer_select {
+ struct target_snd_timer_id id;
+ unsigned char reserved[32];
+};
+
/* alsa timer ioctls */
#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int)
#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \
@@ -2484,6 +2489,8 @@ struct target_snd_timer_gstatus {
struct target_snd_timer_gparams)
#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \
struct target_snd_timer_gstatus)
+#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \
+ struct target_snd_timer_select)
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index adcfa2822468..81bc71938241 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -116,6 +116,10 @@ STRUCT(snd_timer_gstatus,
TYPE_ULONG, /* resolution_den */
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+STRUCT(snd_timer_select,
+ MK_STRUCT(STRUCT_snd_timer_id), /* id */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
/* loop device ioctls */
STRUCT(loop_info,
TYPE_INT, /* lo_number */
--
2.24.1
^ permalink raw reply related
* Re: [PATCH 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely
From: Miguel Ojeda @ 2020-02-20 9:26 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
clang-built-linux, sparclinux, Borislav Petkov, H. Peter Anvin,
linux-kernel
In-Reply-To: <20200220071140.14080-2-masahiroy@kernel.org>
On Thu, Feb 20, 2020 at 8:12 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
> forcibly") made this always-on option. We released v5.4 and v5.5
> including that commit.
>
> Remove the CONFIG option and clean up the code now.
Yes, please!
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cheers,
Miguel
^ permalink raw reply
* Re: [PATCH 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely
From: Miguel Ojeda @ 2020-02-20 9:26 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
clang-built-linux, sparclinux, Borislav Petkov, H. Peter Anvin,
linux-kernel
In-Reply-To: <20200220071140.14080-2-masahiroy@kernel.org>
On Thu, Feb 20, 2020 at 8:12 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
> forcibly") made this always-on option. We released v5.4 and v5.5
> including that commit.
>
> Remove the CONFIG option and clean up the code now.
Yes, please!
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cheers,
Miguel
^ permalink raw reply
* Re: vc4 on rpi3 A+
From: Nicolas Saenz Julienne @ 2020-02-20 9:25 UTC (permalink / raw)
To: Sergey Suloev, linux-rpi-kernel
Cc: Stefan Wahren, Noralf Trønnes, bcm-kernel-feedback-list,
linux-arm-kernel
In-Reply-To: <8b353626-f62a-2aff-96b4-91712ed36095@orpaltech.com>
[-- Attachment #1.1: Type: text/plain, Size: 2114 bytes --]
Hi Sergey,
On Thu, 2020-02-20 at 11:21 +0300, Sergey Suloev wrote:
> Hello, guys,
>
> could anyone clarify the status of vc4 drm support on RPI 3A+ ?
I don't have one so I can't really tell for that specific board, but I'm going
to try to reproduce it on a rpi3b.
> I tried to build kernel 5.5 and 5.6-rc2 in 32bit and aarch64
> configurations with VC4 turned ON but both unsuccessful - vc4 drm driver
> is listed in memory but not working and not producing any typical DRM
> log output.
AFAIK there is a known issue in 5.6-rc2, which has already been addressed[1].
Note that the driver fails on probe so there is some amount of DRM output.
I tried to reproduce your issue with v5.5, but vc4 seems to probe alright
(rpi3b+aarch64+defconfig):
[ 15.443047] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[ 15.452864] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
[ 15.459836] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[ 15.467062] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[ 15.478722] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[ 15.485749] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[ 15.499009] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 15.526217] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 15.542257] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 15.560113] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[ 15.574684] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 15.587375] [drm] Driver supports precise vblank timestamp query.
[ 15.606831] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[ 15.617505] Console: switching to colour frame buffer device 90x30
[ 15.627858] vc4-drm soc:gpu: fb0: vc4drmfb frame buffer device
Could it be that you forgot to update the device tree or kernel modules?
Regards,
Nicolas
[1] https://lkml.kernel.org/lkml/20200219102526.692126-1-jbrunet@baylibre.com/T/
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.