From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446176; cv=none; d=zohomail.com; s=zohoarc; b=ihOLr0rZN/5m2uOYdafkgcbmNEKEnQyBGDkJ2Oiu9fUshV4u+vQhF1lhXQ99BhiXOCa0AQ0FwuXDyGdPWbeeN+M8cXCWjU0/NVAYViwpIVliWS7zrPGyDp05jnccHhm001IzFaLBv0apqOYjhRw9phIK8nYghSauJjHF1uJEfBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446176; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xf2I6AVSrGRq/duV5gv6UTIln0Sg/9kyZt7swxOVAAg=; b=LOFgDZBvkckkLNK8JzXu9N3PoRERk40svyBD5FXVD6CBaw9RQUL43xTe6ZvDPjw+/qzW5t8hiGe7ctoM3cL1V0dWWMmGapq1FW1migMnQC9cCdLU4FghceJRvhSKWsbz1fQgQ9fwh52r74Gca8oa04sFZaBVq7pCZdtf5jcvWUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600446176554491.8948814639224; Fri, 18 Sep 2020 09:22:56 -0700 (PDT) Received: from localhost ([::1]:52648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJ9z-0006qi-3g for importer@patchew.org; Fri, 18 Sep 2020 12:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7P-00050t-Ul for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:17 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52234 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7I-0005Wi-MJ for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:13 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-eGC1dhLJNa2HEvU5wKaCkw-1; Fri, 18 Sep 2020 12:20:05 -0400 Received: by mail-wr1-f70.google.com with SMTP id o6so2320198wrp.1 for ; Fri, 18 Sep 2020 09:20:05 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id u8sm5580291wmj.45.2020.09.18.09.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xf2I6AVSrGRq/duV5gv6UTIln0Sg/9kyZt7swxOVAAg=; b=W1KSwKPReDzg0XAlbfhJWUbGepoxAN0h5wDVXKLc/4q0JmGpy0mFIOe0q1o4ZIUDmvUotW WsdAJN5lxAnVXePLR0FK0r400FRFhkpntsodvnLUEN5/ffxbiEHH3ysUHFsDZb41sgyZW5 ACpbJU7iWEHGXVZ9vQekdraq3oP9eYk= X-MC-Unique: eGC1dhLJNa2HEvU5wKaCkw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xf2I6AVSrGRq/duV5gv6UTIln0Sg/9kyZt7swxOVAAg=; b=DmgPm9CFCo7TD8fGozKRS9NKrhZikY58ZfY+5aoIxTqQw7keq+WY8aeBgYH/r00V1x A1+bS9qU6JK/DC6uxHtcsfgkObNXH8/ANTqv1MkUl/EeBNlJb7Sae1AYSOT56V4zR9po 0por44KyqOm7f0d/yvEU06Ve0WNuoo+tEHzAZLxtN6/Wj4mEDgC+8cI89hYJULtlAvr4 MVMjflg1pNACWJysKVzTTHc5EOlb2HAyk3CEiuWYY29E5NXAxlmDJVDesOyd7yghZK3t o0eNsEtgN3PNKyjQkQyFG7+xRlH91la50Q6cSoAS8Qy3uwR76BLwSATJutW2KQTVskJg QX9Q== X-Gm-Message-State: AOAM530SZ+LHrVeLYAhg3cHpmU8Us8eZbelHAH1yH0t11uxLXY7jn4RH RqkKPUWA0NfRd1x5AwjwzJFDDnvsZDUJpHIsIgufGrPTL/+t8psojmM9FPfU5O5i0sLu6W3iXZ/ VOG+flKrEsdOEz0c= X-Received: by 2002:adf:f701:: with SMTP id r1mr39144090wrp.341.1600446002703; Fri, 18 Sep 2020 09:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ4kuYAhAJjbRNsa2h6rVNzRIBo3Ze0sEFReJSsWHGDwE/RL6KpNhyjLkYo9ZxJIxAe7njEA== X-Received: by 2002:adf:f701:: with SMTP id r1mr39144036wrp.341.1600446002110; Fri, 18 Sep 2020 09:20:02 -0700 (PDT) Date: Fri, 18 Sep 2020 12:19:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 01/15] linux headers: sync to 5.9-rc4 Message-ID: <20200918161836.318893-2-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 11:06:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Cornelia Huck , kvm@vger.kernel.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang Update against Linux 5.9-rc4. Cc: Cornelia Huck Cc: Paolo Bonzini Signed-off-by: Jason Wang Message-Id: <20200907104903.31551-2-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/standard-headers/drm/drm_fourcc.h | 140 ++++++++++++++++++ include/standard-headers/linux/ethtool.h | 87 +++++++++++ .../linux/input-event-codes.h | 3 +- include/standard-headers/linux/vhost_types.h | 11 ++ include/standard-headers/linux/virtio_9p.h | 4 +- include/standard-headers/linux/virtio_blk.h | 26 ++-- .../standard-headers/linux/virtio_config.h | 8 +- .../standard-headers/linux/virtio_console.h | 8 +- include/standard-headers/linux/virtio_net.h | 6 +- include/standard-headers/linux/virtio_scsi.h | 20 +-- linux-headers/asm-generic/unistd.h | 6 +- linux-headers/asm-mips/unistd_n32.h | 1 + linux-headers/asm-mips/unistd_n64.h | 1 + linux-headers/asm-mips/unistd_o32.h | 1 + linux-headers/asm-powerpc/kvm.h | 5 + linux-headers/asm-powerpc/unistd_32.h | 1 + linux-headers/asm-powerpc/unistd_64.h | 1 + linux-headers/asm-s390/kvm.h | 7 +- linux-headers/asm-s390/unistd_32.h | 1 + linux-headers/asm-s390/unistd_64.h | 1 + linux-headers/asm-x86/unistd_32.h | 1 + linux-headers/asm-x86/unistd_64.h | 1 + linux-headers/asm-x86/unistd_x32.h | 1 + linux-headers/linux/kvm.h | 4 + linux-headers/linux/vfio.h | 2 +- linux-headers/linux/vhost.h | 2 + 26 files changed, 308 insertions(+), 41 deletions(-) diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-h= eaders/drm/drm_fourcc.h index 909a66753c..0de1a552ca 100644 --- a/include/standard-headers/drm/drm_fourcc.h +++ b/include/standard-headers/drm/drm_fourcc.h @@ -235,6 +235,12 @@ extern "C" { #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled= Cb:Cr plane */ #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled= Cr:Cb plane */ #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled= Cb:Cr plane */ +/* + * 2 plane YCbCr + * index 0 =3D Y plane, [39:0] Y3:Y2:Y1:Y0 little endian + * index 1 =3D Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian + */ +#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled= Cr:Cb plane */ =20 /* * 2 plane YCbCr MSB aligned @@ -264,6 +270,22 @@ extern "C" { */ #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled= Cr:Cb plane 16 bits per channel */ =20 +/* 3 plane non-subsampled (444) YCbCr + * 16 bits per component, but only 10 bits are used and 6 bits are padded + * index 0: Y plane, [15:0] Y:x [10:6] little endian + * index 1: Cb plane, [15:0] Cb:x [10:6] little endian + * index 2: Cr plane, [15:0] Cr:x [10:6] little endian + */ +#define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0') + +/* 3 plane non-subsampled (444) YCrCb + * 16 bits per component, but only 10 bits are used and 6 bits are padded + * index 0: Y plane, [15:0] Y:x [10:6] little endian + * index 1: Cr plane, [15:0] Cr:x [10:6] little endian + * index 2: Cb plane, [15:0] Cb:x [10:6] little endian + */ +#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') + /* * 3 plane YCbCr * index 0: Y plane, [7:0] Y @@ -308,6 +330,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 +#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a =20 /* add more to the end as needed */ =20 @@ -322,8 +345,33 @@ extern "C" { * When adding a new token please document the layout with a code comment, * similar to the fourcc codes above. drm_fourcc.h is considered the * authoritative source for all of these. + * + * Generic modifier names: + * + * DRM_FORMAT_MOD_GENERIC_* definitions are used to provide vendor-neutral= names + * for layouts which are common across multiple vendors. To preserve + * compatibility, in cases where a vendor-specific definition already exis= ts and + * a generic name for it is desired, the common name is a purely symbolic = alias + * and must use the same numerical value as the original definition. + * + * Note that generic names should only be used for modifiers which describe + * generic layouts (such as pixel re-ordering), which may have + * independently-developed support across multiple vendors. + * + * In future cases where a generic layout is identified before merging wit= h a + * vendor-specific modifier, a new 'GENERIC' vendor or modifier using vend= or + * 'NONE' could be considered. This should only be for obvious, exceptional + * cases to avoid polluting the 'GENERIC' namespace with modifiers which o= nly + * apply to a single vendor. + * + * Generic names should not be used for cases where multiple hardware vend= ors + * have implementations of the same standardised compression scheme (such = as + * AFBC). In those cases, all implementations should use the same format + * modifier(s), reflecting the vendor of the standard. */ =20 +#define DRM_FORMAT_MOD_GENERIC_16_16_TILE DRM_FORMAT_MOD_SAMSUNG_16_16_TILE + /* * Invalid Modifier * @@ -891,6 +939,18 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t mod= ifier) */ #define AFBC_FORMAT_MOD_BCH (1ULL << 11) =20 +/* AFBC uncompressed storage mode + * + * Indicates that the buffer is using AFBC uncompressed storage mode. + * In this mode all superblock payloads in the buffer use the uncompressed + * storage mode, which is usually only used for data which cannot be compr= essed. + * The buffer layout is the same as for AFBC buffers without USM set, this= only + * affects the storage mode of the individual superblocks. Note that even a + * buffer without USM set may use uncompressed storage mode for some or all + * superblocks, USM just guarantees it for all. + */ +#define AFBC_FORMAT_MOD_USM (1ULL << 12) + /* * Arm 16x16 Block U-Interleaved modifier * @@ -915,6 +975,86 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t mod= ifier) */ #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) =20 +/* + * Amlogic Video Framebuffer Compression modifiers + * + * Amlogic uses a proprietary lossless image compression protocol and form= at + * for their hardware video codec accelerators, either video decoders or + * video input encoders. + * + * It considerably reduces memory bandwidth while writing and reading + * frames in memory. + * + * The underlying storage is considered to be 3 components, 8bit or 10-bit + * per component YCbCr 420, single plane : + * - DRM_FORMAT_YUV420_8BIT + * - DRM_FORMAT_YUV420_10BIT + * + * The first 8 bits of the mode defines the layout, then the following 8 b= its + * defines the options changing the layout. + * + * Not all combinations are valid, and different SoCs may support different + * combinations of layout and options. + */ +#define __fourcc_mod_amlogic_layout_mask 0xf +#define __fourcc_mod_amlogic_options_shift 8 +#define __fourcc_mod_amlogic_options_mask 0xf + +#define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \ + fourcc_mod_code(AMLOGIC, \ + ((__layout) & __fourcc_mod_amlogic_layout_mask) | \ + (((__options) & __fourcc_mod_amlogic_options_mask) \ + << __fourcc_mod_amlogic_options_shift)) + +/* Amlogic FBC Layouts */ + +/* + * Amlogic FBC Basic Layout + * + * The basic layout is composed of: + * - a body content organized in 64x32 superblocks with 4096 bytes per + * superblock in default mode. + * - a 32 bytes per 128x64 header block + * + * This layout is transferrable between Amlogic SoCs supporting this modif= ier. + */ +#define AMLOGIC_FBC_LAYOUT_BASIC (1ULL) + +/* + * Amlogic FBC Scatter Memory layout + * + * Indicates the header contains IOMMU references to the compressed + * frames content to optimize memory access and layout. + * + * In this mode, only the header memory address is needed, thus the + * content memory organization is tied to the current producer + * execution and cannot be saved/dumped neither transferrable between + * Amlogic SoCs supporting this modifier. + * + * Due to the nature of the layout, these buffers are not expected to + * be accessible by the user-space clients, but only accessible by the + * hardware producers and consumers. + * + * The user-space clients should expect a failure while trying to mmap + * the DMA-BUF handle returned by the producer. + */ +#define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL) + +/* Amlogic FBC Layout Options Bit Mask */ + +/* + * Amlogic FBC Memory Saving mode + * + * Indicates the storage is packed when pixel size is multiple of word + * boudaries, i.e. 8bit should be stored in this mode to save allocation + * memory. + * + * This mode reduces body layout to 3072 bytes per 64x32 superblock with + * the basic layout and 3200 bytes per 64x32 superblock combined with + * the scatter layout. + */ +#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0) + #if defined(__cplusplus) } #endif diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-he= aders/linux/ethtool.h index fd8d2cccfe..e13eff4488 100644 --- a/include/standard-headers/linux/ethtool.h +++ b/include/standard-headers/linux/ethtool.h @@ -579,6 +579,76 @@ struct ethtool_pauseparam { uint32_t tx_pause; }; =20 +/** + * enum ethtool_link_ext_state - link extended state + */ +enum ethtool_link_ext_state { + ETHTOOL_LINK_EXT_STATE_AUTONEG, + ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, + ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH, + ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY, + ETHTOOL_LINK_EXT_STATE_NO_CABLE, + ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE, + ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE, + ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE, + ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED, + ETHTOOL_LINK_EXT_STATE_OVERHEAT, +}; + +/** + * enum ethtool_link_ext_substate_autoneg - more information in addition to + * ETHTOOL_LINK_EXT_STATE_AUTONEG. + */ +enum ethtool_link_ext_substate_autoneg { + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED =3D 1, + ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE, + ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD, +}; + +/** + * enum ethtool_link_ext_substate_link_training - more information in addi= tion to + * ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE. + */ +enum ethtool_link_ext_substate_link_training { + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED =3D 1, + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT, + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY, + ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT, +}; + +/** + * enum ethtool_link_ext_substate_logical_mismatch - more information in a= ddition + * to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH. + */ +enum ethtool_link_ext_substate_link_logical_mismatch { + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK =3D 1, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED, +}; + +/** + * enum ethtool_link_ext_substate_bad_signal_integrity - more information = in + * addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY. + */ +enum ethtool_link_ext_substate_bad_signal_integrity { + ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS =3D 1, + ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE, +}; + +/** + * enum ethtool_link_ext_substate_cable_issue - more information in + * addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. + */ +enum ethtool_link_ext_substate_cable_issue { + ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE =3D 1, + ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, +}; + #define ETH_GSTRING_LEN 32 =20 /** @@ -599,6 +669,7 @@ struct ethtool_pauseparam { * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags * @ETH_SS_TS_TX_TYPES: timestamping Tx types * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters + * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types */ enum ethtool_stringset { ETH_SS_TEST =3D 0, @@ -616,6 +687,7 @@ enum ethtool_stringset { ETH_SS_SOF_TIMESTAMPING, ETH_SS_TS_TX_TYPES, ETH_SS_TS_RX_FILTERS, + ETH_SS_UDP_TUNNEL_TYPES, =20 /* add new constants above here */ ETH_SS_COUNT @@ -1530,6 +1602,21 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT =3D 72, ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT =3D 73, ETHTOOL_LINK_MODE_FEC_LLRS_BIT =3D 74, + ETHTOOL_LINK_MODE_100000baseKR_Full_BIT =3D 75, + ETHTOOL_LINK_MODE_100000baseSR_Full_BIT =3D 76, + ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT =3D 77, + ETHTOOL_LINK_MODE_100000baseCR_Full_BIT =3D 78, + ETHTOOL_LINK_MODE_100000baseDR_Full_BIT =3D 79, + ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT =3D 80, + ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT =3D 81, + ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT =3D 82, + ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT =3D 83, + ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT =3D 84, + ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT =3D 85, + ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT =3D 86, + ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT =3D 87, + ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT =3D 88, + ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT =3D 89, /* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS }; diff --git a/include/standard-headers/linux/input-event-codes.h b/include/s= tandard-headers/linux/input-event-codes.h index ebf72c1031..e740ad9f2e 100644 --- a/include/standard-headers/linux/input-event-codes.h +++ b/include/standard-headers/linux/input-event-codes.h @@ -888,7 +888,8 @@ #define SW_LINEIN_INSERT 0x0d /* set =3D inserted */ #define SW_MUTE_DEVICE 0x0e /* set =3D device disabled */ #define SW_PEN_INSERTED 0x0f /* set =3D pen inserted */ -#define SW_MAX_ 0x0f +#define SW_MACHINE_COVER 0x10 /* set =3D cover closed */ +#define SW_MAX_ 0x10 #define SW_CNT (SW_MAX_+1) =20 /* diff --git a/include/standard-headers/linux/vhost_types.h b/include/standar= d-headers/linux/vhost_types.h index a678d8fbaa..486630b332 100644 --- a/include/standard-headers/linux/vhost_types.h +++ b/include/standard-headers/linux/vhost_types.h @@ -60,6 +60,17 @@ struct vhost_iotlb_msg { #define VHOST_IOTLB_UPDATE 2 #define VHOST_IOTLB_INVALIDATE 3 #define VHOST_IOTLB_ACCESS_FAIL 4 +/* + * VHOST_IOTLB_BATCH_BEGIN and VHOST_IOTLB_BATCH_END allow modifying + * multiple mappings in one go: beginning with + * VHOST_IOTLB_BATCH_BEGIN, followed by any number of + * VHOST_IOTLB_UPDATE messages, and ending with VHOST_IOTLB_BATCH_END. + * When one of these two values is used as the message type, the rest + * of the fields in the message are ignored. There's no guarantee that + * these changes take place automatically in the device. + */ +#define VHOST_IOTLB_BATCH_BEGIN 5 +#define VHOST_IOTLB_BATCH_END 6 uint8_t type; }; =20 diff --git a/include/standard-headers/linux/virtio_9p.h b/include/standard-= headers/linux/virtio_9p.h index e68f71dbe6..f5604fc5fb 100644 --- a/include/standard-headers/linux/virtio_9p.h +++ b/include/standard-headers/linux/virtio_9p.h @@ -25,7 +25,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#include "standard-headers/linux/types.h" +#include "standard-headers/linux/virtio_types.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_config.h" =20 @@ -36,7 +36,7 @@ =20 struct virtio_9p_config { /* length of the tag name */ - uint16_t tag_len; + __virtio16 tag_len; /* non-NULL terminated tag name */ uint8_t tag[0]; } QEMU_PACKED; diff --git a/include/standard-headers/linux/virtio_blk.h b/include/standard= -headers/linux/virtio_blk.h index 0229b0fbe4..2dcc90826a 100644 --- a/include/standard-headers/linux/virtio_blk.h +++ b/include/standard-headers/linux/virtio_blk.h @@ -55,20 +55,20 @@ =20 struct virtio_blk_config { /* The capacity (in 512-byte sectors). */ - uint64_t capacity; + __virtio64 capacity; /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ - uint32_t size_max; + __virtio32 size_max; /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ - uint32_t seg_max; + __virtio32 seg_max; /* geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */ struct virtio_blk_geometry { - uint16_t cylinders; + __virtio16 cylinders; uint8_t heads; uint8_t sectors; } geometry; =20 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ - uint32_t blk_size; + __virtio32 blk_size; =20 /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ /* exponent for physical block per logical block. */ @@ -76,42 +76,42 @@ struct virtio_blk_config { /* alignment offset in logical blocks. */ uint8_t alignment_offset; /* minimum I/O size without performance penalty in logical blocks. */ - uint16_t min_io_size; + __virtio16 min_io_size; /* optimal sustained I/O size in logical blocks. */ - uint32_t opt_io_size; + __virtio32 opt_io_size; =20 /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ uint8_t wce; uint8_t unused; =20 /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */ - uint16_t num_queues; + __virtio16 num_queues; =20 /* the next 3 entries are guarded by VIRTIO_BLK_F_DISCARD */ /* * The maximum discard sectors (in 512-byte sectors) for * one segment. */ - uint32_t max_discard_sectors; + __virtio32 max_discard_sectors; /* * The maximum number of discard segments in a * discard command. */ - uint32_t max_discard_seg; + __virtio32 max_discard_seg; /* Discard commands must be aligned to this number of sectors. */ - uint32_t discard_sector_alignment; + __virtio32 discard_sector_alignment; =20 /* the next 3 entries are guarded by VIRTIO_BLK_F_WRITE_ZEROES */ /* * The maximum number of write zeroes sectors (in 512-byte sectors) in * one segment. */ - uint32_t max_write_zeroes_sectors; + __virtio32 max_write_zeroes_sectors; /* * The maximum number of segments in a write zeroes * command. */ - uint32_t max_write_zeroes_seg; + __virtio32 max_write_zeroes_seg; /* * Set if a VIRTIO_BLK_T_WRITE_ZEROES request may result in the * deallocation of one or more of the sectors. diff --git a/include/standard-headers/linux/virtio_config.h b/include/stand= ard-headers/linux/virtio_config.h index 9a69d9e242..22e3a85f67 100644 --- a/include/standard-headers/linux/virtio_config.h +++ b/include/standard-headers/linux/virtio_config.h @@ -67,13 +67,15 @@ #define VIRTIO_F_VERSION_1 32 =20 /* - * If clear - device has the IOMMU bypass quirk feature. - * If set - use platform tools to detect the IOMMU. + * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk featur= e. + * If set - use platform DMA tools to access the memory. * * Note the reverse polarity (compared to most other features), * this is for compatibility with legacy systems. */ -#define VIRTIO_F_IOMMU_PLATFORM 33 +#define VIRTIO_F_ACCESS_PLATFORM 33 +/* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old us= erspace) */ +#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM =20 /* This feature indicates support for the packed virtqueue layout. */ #define VIRTIO_F_RING_PACKED 34 diff --git a/include/standard-headers/linux/virtio_console.h b/include/stan= dard-headers/linux/virtio_console.h index 0dedc9e6f5..71f5f648e3 100644 --- a/include/standard-headers/linux/virtio_console.h +++ b/include/standard-headers/linux/virtio_console.h @@ -45,13 +45,13 @@ =20 struct virtio_console_config { /* colums of the screens */ - uint16_t cols; + __virtio16 cols; /* rows of the screens */ - uint16_t rows; + __virtio16 rows; /* max. number of ports this device can hold */ - uint32_t max_nr_ports; + __virtio32 max_nr_ports; /* emergency write register */ - uint32_t emerg_wr; + __virtio32 emerg_wr; } QEMU_PACKED; =20 /* diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard= -headers/linux/virtio_net.h index a90f79e1b1..e0a070518f 100644 --- a/include/standard-headers/linux/virtio_net.h +++ b/include/standard-headers/linux/virtio_net.h @@ -87,14 +87,14 @@ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ uint8_t mac[ETH_ALEN]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ - uint16_t status; + __virtio16 status; /* Maximum number of each of transmit and receive queues; * see VIRTIO_NET_F_MQ and VIRTIO_NET_CTRL_MQ. * Legal values are between 1 and 0x8000 */ - uint16_t max_virtqueue_pairs; + __virtio16 max_virtqueue_pairs; /* Default maximum transmit unit advice */ - uint16_t mtu; + __virtio16 mtu; /* * speed, in units of 1Mb. All values 0 to INT_MAX are legal. * Any other value stands for unknown. diff --git a/include/standard-headers/linux/virtio_scsi.h b/include/standar= d-headers/linux/virtio_scsi.h index ab66166b6a..663f36cbb7 100644 --- a/include/standard-headers/linux/virtio_scsi.h +++ b/include/standard-headers/linux/virtio_scsi.h @@ -103,16 +103,16 @@ struct virtio_scsi_event { } QEMU_PACKED; =20 struct virtio_scsi_config { - uint32_t num_queues; - uint32_t seg_max; - uint32_t max_sectors; - uint32_t cmd_per_lun; - uint32_t event_info_size; - uint32_t sense_size; - uint32_t cdb_size; - uint16_t max_channel; - uint16_t max_target; - uint32_t max_lun; + __virtio32 num_queues; + __virtio32 seg_max; + __virtio32 max_sectors; + __virtio32 cmd_per_lun; + __virtio32 event_info_size; + __virtio32 sense_size; + __virtio32 cdb_size; + __virtio16 max_channel; + __virtio16 max_target; + __virtio32 max_lun; } QEMU_PACKED; =20 /* Feature Bits */ diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic= /unistd.h index f4a01305d9..995b36c2ea 100644 --- a/linux-headers/asm-generic/unistd.h +++ b/linux-headers/asm-generic/unistd.h @@ -606,9 +606,9 @@ __SYSCALL(__NR_sendto, sys_sendto) #define __NR_recvfrom 207 __SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) #define __NR_setsockopt 208 -__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) +__SC_COMP(__NR_setsockopt, sys_setsockopt, sys_setsockopt) #define __NR_getsockopt 209 -__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) +__SC_COMP(__NR_getsockopt, sys_getsockopt, sys_getsockopt) #define __NR_shutdown 210 __SYSCALL(__NR_shutdown, sys_shutdown) #define __NR_sendmsg 211 @@ -850,6 +850,8 @@ __SYSCALL(__NR_pidfd_open, sys_pidfd_open) #define __NR_clone3 435 __SYSCALL(__NR_clone3, sys_clone3) #endif +#define __NR_close_range 436 +__SYSCALL(__NR_close_range, sys_close_range) =20 #define __NR_openat2 437 __SYSCALL(__NR_openat2, sys_openat2) diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/u= nistd_n32.h index 3b9eda7e7d..246fbb6a78 100644 --- a/linux-headers/asm-mips/unistd_n32.h +++ b/linux-headers/asm-mips/unistd_n32.h @@ -365,6 +365,7 @@ #define __NR_fspick (__NR_Linux + 433) #define __NR_pidfd_open (__NR_Linux + 434) #define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) #define __NR_openat2 (__NR_Linux + 437) #define __NR_pidfd_getfd (__NR_Linux + 438) #define __NR_faccessat2 (__NR_Linux + 439) diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/u= nistd_n64.h index 9cdf9b6c60..194d777dfd 100644 --- a/linux-headers/asm-mips/unistd_n64.h +++ b/linux-headers/asm-mips/unistd_n64.h @@ -341,6 +341,7 @@ #define __NR_fspick (__NR_Linux + 433) #define __NR_pidfd_open (__NR_Linux + 434) #define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) #define __NR_openat2 (__NR_Linux + 437) #define __NR_pidfd_getfd (__NR_Linux + 438) #define __NR_faccessat2 (__NR_Linux + 439) diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/u= nistd_o32.h index e3e5e238f0..3e093dd913 100644 --- a/linux-headers/asm-mips/unistd_o32.h +++ b/linux-headers/asm-mips/unistd_o32.h @@ -411,6 +411,7 @@ #define __NR_fspick (__NR_Linux + 433) #define __NR_pidfd_open (__NR_Linux + 434) #define __NR_clone3 (__NR_Linux + 435) +#define __NR_close_range (__NR_Linux + 436) #define __NR_openat2 (__NR_Linux + 437) #define __NR_pidfd_getfd (__NR_Linux + 438) #define __NR_faccessat2 (__NR_Linux + 439) diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kv= m.h index 264e266a85..c3af3f324c 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -640,6 +640,11 @@ struct kvm_ppc_cpu_char { #define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) #define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) =20 +/* POWER10 registers */ +#define KVM_REG_PPC_MMCR3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc1) +#define KVM_REG_PPC_SIER2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc2) +#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3) + /* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs */ diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powe= rpc/unistd_32.h index 862edb7448..0db9481d49 100644 --- a/linux-headers/asm-powerpc/unistd_32.h +++ b/linux-headers/asm-powerpc/unistd_32.h @@ -418,6 +418,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powe= rpc/unistd_64.h index f553224ce4..9f74310988 100644 --- a/linux-headers/asm-powerpc/unistd_64.h +++ b/linux-headers/asm-powerpc/unistd_64.h @@ -390,6 +390,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h index 0138ccb0d8..f053b8304a 100644 --- a/linux-headers/asm-s390/kvm.h +++ b/linux-headers/asm-s390/kvm.h @@ -231,11 +231,13 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_GSCB (1UL << 9) #define KVM_SYNC_BPBC (1UL << 10) #define KVM_SYNC_ETOKEN (1UL << 11) +#define KVM_SYNC_DIAG318 (1UL << 12) =20 #define KVM_SYNC_S390_VALID_FIELDS \ (KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \ KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \ - KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN) + KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN | \ + KVM_SYNC_DIAG318) =20 /* length and alignment of the sdnx as a power of two */ #define SDNXC 8 @@ -264,7 +266,8 @@ struct kvm_sync_regs { __u8 reserved2 : 7; __u8 padding1[51]; /* riccb needs to be 64byte aligned */ __u8 riccb[64]; /* runtime instrumentation controls block */ - __u8 padding2[192]; /* sdnx needs to be 256byte aligned */ + __u64 diag318; /* diagnose 0x318 info */ + __u8 padding2[184]; /* sdnx needs to be 256byte aligned */ union { __u8 sdnx[SDNXL]; /* state description annex */ struct { diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/un= istd_32.h index e08233c0c3..1803cd0c3b 100644 --- a/linux-headers/asm-s390/unistd_32.h +++ b/linux-headers/asm-s390/unistd_32.h @@ -408,6 +408,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/un= istd_64.h index 560e19ae2b..228d5004e5 100644 --- a/linux-headers/asm-s390/unistd_64.h +++ b/linux-headers/asm-s390/unistd_64.h @@ -356,6 +356,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unis= td_32.h index c727981d4a..356c12c2db 100644 --- a/linux-headers/asm-x86/unistd_32.h +++ b/linux-headers/asm-x86/unistd_32.h @@ -426,6 +426,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unis= td_64.h index 843fa62745..ef70e1c7c9 100644 --- a/linux-headers/asm-x86/unistd_64.h +++ b/linux-headers/asm-x86/unistd_64.h @@ -348,6 +348,7 @@ #define __NR_fspick 433 #define __NR_pidfd_open 434 #define __NR_clone3 435 +#define __NR_close_range 436 #define __NR_openat2 437 #define __NR_pidfd_getfd 438 #define __NR_faccessat2 439 diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/uni= std_x32.h index 7d63d703ca..84ae8e9f5f 100644 --- a/linux-headers/asm-x86/unistd_x32.h +++ b/linux-headers/asm-x86/unistd_x32.h @@ -301,6 +301,7 @@ #define __NR_fspick (__X32_SYSCALL_BIT + 433) #define __NR_pidfd_open (__X32_SYSCALL_BIT + 434) #define __NR_clone3 (__X32_SYSCALL_BIT + 435) +#define __NR_close_range (__X32_SYSCALL_BIT + 436) #define __NR_openat2 (__X32_SYSCALL_BIT + 437) #define __NR_pidfd_getfd (__X32_SYSCALL_BIT + 438) #define __NR_faccessat2 (__X32_SYSCALL_BIT + 439) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index a28c366737..6683e2e1b0 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -289,6 +289,7 @@ struct kvm_run { /* KVM_EXIT_FAIL_ENTRY */ struct { __u64 hardware_entry_failure_reason; + __u32 cpu; } fail_entry; /* KVM_EXIT_EXCEPTION */ struct { @@ -1031,6 +1032,9 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_PPC_SECURE_GUEST 181 #define KVM_CAP_HALT_POLL 182 #define KVM_CAP_ASYNC_PF_INT 183 +#define KVM_CAP_LAST_CPU 184 +#define KVM_CAP_SMALLER_MAXPHYADDR 185 +#define KVM_CAP_S390_DIAG318 186 =20 #ifdef KVM_CAP_IRQ_ROUTING =20 diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index f09df262c4..a90672494d 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -1030,7 +1030,7 @@ struct vfio_iommu_type1_info_cap_iova_range { * size in bytes that can be used by user applications when getting the di= rty * bitmap. */ -#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 1 +#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2 =20 struct vfio_iommu_type1_info_cap_migration { struct vfio_info_cap_header header; diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index 0c2349612e..7523218532 100644 --- a/linux-headers/linux/vhost.h +++ b/linux-headers/linux/vhost.h @@ -91,6 +91,8 @@ =20 /* Use message type V2 */ #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 +/* IOTLB can accept batching hints */ +#define VHOST_BACKEND_F_IOTLB_BATCH 0x2 =20 #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64) --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446671; cv=none; d=zohomail.com; s=zohoarc; b=Wdi3d+YuScG0KtlFB8TM+paMqvNtsvAMIIULH1Z5lvbpfjp7cji65yjOrq8LYmMaBX3McJLp1ZmAAUxp2WrWcQ9Zzn+0mSlYKVRh2LWDwd26A/TVQ4XQbQSL/30qBwg98obyQqF06/zcOPI1WcuL5hZ6eKvxem+Spkpaqkmx2zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446671; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qmTXxwrSFY2mMpUUnscQSUtPOEOWVGicMQRRdIRDUlc=; b=P9AOcESAdl1iHX8/4ID4V1O3WVVM4cm9ugZwSzcopUOlbQux6Kb0AhalAw/SXjYqTWsQ9ozrD/yIr1Pxfgh+hZJ5nw1PmkyjNVitYjNczL4VOyaP51fKD+ftdqrrMzf8Vf1JEdGLD4liEHbRaWFYA2wCsCWOycN/7NLOw4NXmz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600446671257592.0667496884876; Fri, 18 Sep 2020 09:31:11 -0700 (PDT) Received: from localhost ([::1]:41198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJHx-0005Yg-Ls for importer@patchew.org; Fri, 18 Sep 2020 12:31:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ8T-0005Xw-5r for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ8K-0005pg-Qr for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:20 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-vWoVPPkrPbWiLs1AZ7f8SQ-1; Fri, 18 Sep 2020 12:21:08 -0400 Received: by mail-wr1-f70.google.com with SMTP id w7so2332142wrp.2 for ; Fri, 18 Sep 2020 09:21:07 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id h8sm6137225wrw.68.2020.09.18.09.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qmTXxwrSFY2mMpUUnscQSUtPOEOWVGicMQRRdIRDUlc=; b=UoSC9+MOV/TB3902sdt7b3/rh2LksbQw4nvV+adZHHszFDKGCWYcp/IjkdmIGC9OLfRItz 12M8RSFIF8QrnO9ngR6YyJXIBbPnFanAAxcU5K/dkx+ZaU3wizv3dqzBdIhUcgSWksI+n3 IAzhfF5Ag8Sekeekw3qX4lHKuTSLV7Y= X-MC-Unique: vWoVPPkrPbWiLs1AZ7f8SQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qmTXxwrSFY2mMpUUnscQSUtPOEOWVGicMQRRdIRDUlc=; b=I+JKkM5+Bz+F0OhTbN4a45iSy/UDVOOKWtXL+G5CutpB/znB3dvDhvzvV2yfL7V3xF 1vMscaxkMRujmKs1ir/9+M9fZpU/9/50kJBs68uUzFGAumVGnScaGXfSEsWV57O8HUkr VKGSTgT9SqTlsGkm+GAhEHhPp+Dchf92Q6n76AxcPoQBFOvXm3zMJpmcDflgXL0pZkT9 MT7ShobVuUaa29BwjOx5yzbyX31IgCm5qLvInPpwbqeThXT4Lme7g6dlASB2n0/6eQYH z85wlXQFfpzQgZKqtJdqVZaFZK6l8n9c+vhDv2lvVO+kRg2D3QelLrR3fUaq/2n5vgZO kGbQ== X-Gm-Message-State: AOAM530HltcYAcAL62metvkAqpycgimZRf4np1sauOtGGQlHb7i77Sch RD/+13B+gDCFbqsMQ7Ad7G9y1XXxWpWCF5wZoh5V3XYbrPej4tGI1wW5ozFhCW5fgfwLPbYCrMk JRi2kpMMmv3BMBPY= X-Received: by 2002:a5d:574a:: with SMTP id q10mr16182477wrw.127.1600446066465; Fri, 18 Sep 2020 09:21:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8ywKFBzojzVUgcIIa79zLMrVjhcXwKjrxTxNXwiQ3MVyDnGSrhMRaDqHygJ+LywJGaHU9cw== X-Received: by 2002:a5d:574a:: with SMTP id q10mr16182453wrw.127.1600446066182; Fri, 18 Sep 2020 09:21:06 -0700 (PDT) Date: Fri, 18 Sep 2020 12:21:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 02/15] vhost: switch to use IOTLB v2 format Message-ID: <20200918161836.318893-3-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 01:32:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang This patch tries to switch to use new kernel IOTLB format V2. Previous version may have inconsistent ABI between 32bit and 64bit machines because of the hole after type field. Refer kernel commit ("429711aec282 vhost: switch to use new message format") for more information. To enable this feature, qemu need to use a new ioctl VHOST_SET_BACKEND_FEATURE with VHOST_BACKEND_F_IOTLB_MSG_V2 bit. A new vhost setting backend features ops was introduced. And when we try to set features for vhost dev, we will examine the support of new IOTLB format and enable it. This process is total transparent to guest, which means we can have different IOTLB message type in src and dst during migration. The conversion of IOTLB message is straightforward, just check the type and behave accordingly. Signed-off-by: Jason Wang Message-Id: <20200907104903.31551-3-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-backend.h | 2 + include/hw/virtio/vhost.h | 1 + hw/virtio/vhost-backend.c | 88 +++++++++++++++++++++++++------ hw/virtio/vhost.c | 10 ++++ 4 files changed, 84 insertions(+), 17 deletions(-) diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index 8825bd278f..8a6f8e2a7a 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -74,6 +74,7 @@ typedef int (*vhost_set_features_op)(struct vhost_dev *de= v, uint64_t features); typedef int (*vhost_get_features_op)(struct vhost_dev *dev, uint64_t *features); +typedef int (*vhost_set_backend_cap_op)(struct vhost_dev *dev); typedef int (*vhost_set_owner_op)(struct vhost_dev *dev); typedef int (*vhost_reset_device_op)(struct vhost_dev *dev); typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx); @@ -146,6 +147,7 @@ typedef struct VhostOps { vhost_set_vring_busyloop_timeout_op vhost_set_vring_busyloop_timeout; vhost_set_features_op vhost_set_features; vhost_get_features_op vhost_get_features; + vhost_set_backend_cap_op vhost_set_backend_cap; vhost_set_owner_op vhost_set_owner; vhost_reset_device_op vhost_reset_device; vhost_get_vq_index_op vhost_get_vq_index; diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 767a95ec0b..94585067f7 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -79,6 +79,7 @@ struct vhost_dev { uint64_t backend_features; uint64_t protocol_features; uint64_t max_queues; + uint64_t backend_cap; bool started; bool log_enabled; uint64_t log_size; diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 782b1d67d9..88c8ecc9e0 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -156,6 +156,28 @@ static int vhost_kernel_set_features(struct vhost_dev = *dev, return vhost_kernel_call(dev, VHOST_SET_FEATURES, &features); } =20 +static int vhost_kernel_set_backend_cap(struct vhost_dev *dev) +{ + uint64_t features; + uint64_t f =3D 0x1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2; + int r; + + if (vhost_kernel_call(dev, VHOST_GET_BACKEND_FEATURES, &features)) { + return 0; + } + + features &=3D f; + r =3D vhost_kernel_call(dev, VHOST_SET_BACKEND_FEATURES, + &features); + if (r) { + return 0; + } + + dev->backend_cap =3D features; + + return 0; +} + static int vhost_kernel_get_features(struct vhost_dev *dev, uint64_t *features) { @@ -195,34 +217,65 @@ static int vhost_kernel_vsock_set_running(struct vhos= t_dev *dev, int start) static void vhost_kernel_iotlb_read(void *opaque) { struct vhost_dev *dev =3D opaque; - struct vhost_msg msg; ssize_t len; =20 - while ((len =3D read((uintptr_t)dev->opaque, &msg, sizeof msg)) > 0) { - if (len < sizeof msg) { - error_report("Wrong vhost message len: %d", (int)len); - break; - } - if (msg.type !=3D VHOST_IOTLB_MSG) { - error_report("Unknown vhost iotlb message type"); - break; - } + if (dev->backend_cap & + (0x1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)) { + struct vhost_msg_v2 msg; =20 - vhost_backend_handle_iotlb_msg(dev, &msg.iotlb); + while ((len =3D read((uintptr_t)dev->opaque, &msg, sizeof msg)) > = 0) { + if (len < sizeof msg) { + error_report("Wrong vhost message len: %d", (int)len); + break; + } + if (msg.type !=3D VHOST_IOTLB_MSG_V2) { + error_report("Unknown vhost iotlb message type"); + break; + } + + vhost_backend_handle_iotlb_msg(dev, &msg.iotlb); + } + } else { + struct vhost_msg msg; + + while ((len =3D read((uintptr_t)dev->opaque, &msg, sizeof msg)) > = 0) { + if (len < sizeof msg) { + error_report("Wrong vhost message len: %d", (int)len); + break; + } + if (msg.type !=3D VHOST_IOTLB_MSG) { + error_report("Unknown vhost iotlb message type"); + break; + } + + vhost_backend_handle_iotlb_msg(dev, &msg.iotlb); + } } } =20 static int vhost_kernel_send_device_iotlb_msg(struct vhost_dev *dev, struct vhost_iotlb_msg *imsg) { - struct vhost_msg msg; + if (dev->backend_cap & (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)) { + struct vhost_msg_v2 msg; =20 - msg.type =3D VHOST_IOTLB_MSG; - msg.iotlb =3D *imsg; + msg.type =3D VHOST_IOTLB_MSG_V2; + msg.iotlb =3D *imsg; =20 - if (write((uintptr_t)dev->opaque, &msg, sizeof msg) !=3D sizeof msg) { - error_report("Fail to update device iotlb"); - return -EFAULT; + if (write((uintptr_t)dev->opaque, &msg, sizeof msg) !=3D sizeof ms= g) { + error_report("Fail to update device iotlb"); + return -EFAULT; + } + } else { + struct vhost_msg msg; + + msg.type =3D VHOST_IOTLB_MSG; + msg.iotlb =3D *imsg; + + if (write((uintptr_t)dev->opaque, &msg, sizeof msg) !=3D sizeof ms= g) { + error_report("Fail to update device iotlb"); + return -EFAULT; + } } =20 return 0; @@ -260,6 +313,7 @@ static const VhostOps kernel_ops =3D { vhost_kernel_set_vring_busyloop_timeout, .vhost_set_features =3D vhost_kernel_set_features, .vhost_get_features =3D vhost_kernel_get_features, + .vhost_set_backend_cap =3D vhost_kernel_set_backend_cap, .vhost_set_owner =3D vhost_kernel_set_owner, .vhost_reset_device =3D vhost_kernel_reset_device, .vhost_get_vq_index =3D vhost_kernel_get_vq_index, diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1a1384e7a6..e986bf53e4 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -818,7 +818,17 @@ static int vhost_dev_set_features(struct vhost_dev *de= v, r =3D dev->vhost_ops->vhost_set_features(dev, features); if (r < 0) { VHOST_OPS_DEBUG("vhost_set_features failed"); + goto out; } + if (dev->vhost_ops->vhost_set_backend_cap) { + r =3D dev->vhost_ops->vhost_set_backend_cap(dev); + if (r < 0) { + VHOST_OPS_DEBUG("vhost_set_backend_cap failed"); + goto out; + } + } + +out: return r < 0 ? -errno : 0; } =20 --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447063; cv=none; d=zohomail.com; s=zohoarc; b=QvHUWdTRjIIMxSQwFZC5Lb5w2+up6GNM810kIjj013T7Xqp0hQ7jqVM9vtDJIb35KktMkj8Zy/2iC4Pi9MY0eeaAJZHvLrPGPE5MOLsUOi0Z26Q0N7kmkbC9EW3V/JmVBjcXn5l2G9mHdnKhznHRZnnOm6APhxaXCmPLcmy7rfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447063; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GXFOFA+oBpG8V2C34lkq5FMQCHgmci5cClagY+iuF1U=; b=ZI563xYwVoOuTC3WllMfLmfEPKNgjVW+YxMYB822lhta5taBym3v6oNmHoM+iTHJm+T00W3MnbpvM3h8nl0ydWd0a7lNSjpJBsWYJ5h0pcAZE1FPlG4DLuigSqksfPjKudv5L8tMZtok0Dq2cdEhVOwjTJZjVMij7pS6rFsVxOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447063832803.6360773835005; Fri, 18 Sep 2020 09:37:43 -0700 (PDT) Received: from localhost ([::1]:53488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJOI-0002s2-0J for importer@patchew.org; Fri, 18 Sep 2020 12:37:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ8V-0005d2-Kn for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ8S-0005pt-Pg for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:23 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-3XWGC0-qM0CebWeQm_RQSg-1; Fri, 18 Sep 2020 12:21:16 -0400 Received: by mail-wm1-f72.google.com with SMTP id t8so1625194wmj.6 for ; Fri, 18 Sep 2020 09:21:15 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id u17sm6482588wri.45.2020.09.18.09.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GXFOFA+oBpG8V2C34lkq5FMQCHgmci5cClagY+iuF1U=; b=IqcQk7kNqbAV3sn/JLkWvrQf52cCmo54iy6TJ0E/bXqqyi3STRx6M4eUnUp0cGy1OvpFtI R+b8KFM5P352eQvyvsGlnD84pSygLZnAabQ8NZO9iEMuOFsdjbD7o5aotMXwOluQdxlyxJ PGy/B0o/mcBnTqIXBPWCGqj5lZwrjtM= X-MC-Unique: 3XWGC0-qM0CebWeQm_RQSg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GXFOFA+oBpG8V2C34lkq5FMQCHgmci5cClagY+iuF1U=; b=NIKzceGonShgVli8+Om1yFAV8Vs6PbySvuoeOPqTxtuMO25KEXXb2v8iA9McbuTciN VeN5eiUhqbi+SUS2e0A/i8x2EjY8d2jTP25X6EnZlpFCgFi4UZcbYTNO+mG6ExRiXeJ3 Ozzb9czCGwDasJZDNPyRgfVD93C8kuYQXji66ssoxvT1wBEmHxim2BDc3I38UNbKtjTA bT2UBqZzmcdAWYfTmh5uL3o6E3qOuJjoMp/pNBCADM71t5QEf2r+vjyYv8Zx+h2W0dmf Zb5w+S0AXaP+5w6uOzYxKGahX8QfCzTdCtzIolR8lh7tme2TElceaDvBEgyc1MkoaFeG W0lQ== X-Gm-Message-State: AOAM530lZdX2T4uOseKMs04DxSixem5KsajJEHuO9+BmtdlSNFr0vCvD lNFNblyJbFlCn4AYvEFtEJf2s+VHi6ktgye//9mLhAPSn7CpOzy1iOGXFs+5ZJbiJLWVwl79pUH FRYYQ9EkQGIUp/1Q= X-Received: by 2002:a1c:4b0e:: with SMTP id y14mr16113251wma.156.1600446074394; Fri, 18 Sep 2020 09:21:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLxHv/MQrSauMUsf3fdDcaP9X9zZhuLYFPUx1M0lNXvcly/rvbfD78L2c/ZNtlc67Hwfwbig== X-Received: by 2002:a1c:4b0e:: with SMTP id y14mr16113231wma.156.1600446074195; Fri, 18 Sep 2020 09:21:14 -0700 (PDT) Date: Fri, 18 Sep 2020 12:21:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 03/15] vhost-vdpa: batch updating IOTLB mappings Message-ID: <20200918161836.318893-4-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 01:32:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang To speed up the memory mapping updating between vhost-vDPA and vDPA device driver, this patch passes the IOTLB batching flags via IOTLB API. Two new flags was introduced, VHOST_IOTLB_BATCH_BEGIN is a hint that a bathced IOTLB updating may be initiated from the userspace. VHOST_IOTLB_BATCH_END is a hint that userspace has finished the updating: VHOST_IOTLB_BATCH_BEGIN VHOST_IOTLB_UPDATE/VHOST_IOTLB_INVALIDATE ... VHOST_IOTLB_BATCH_END Vhost-vDPA can then know that all mappings has been set and can do optimization like passing all the mappings to the vDPA device driver. Signed-off-by: Jason Wang Message-Id: <20200907104903.31551-4-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 66 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 6455663388..9b81a409da 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -18,6 +18,7 @@ typedef struct vhost_vdpa { int device_fd; uint32_t msg_type; MemoryListener listener; + struct vhost_dev *dev; } VhostVDPA; =20 extern AddressSpace address_space_memory; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 4580f3efd8..ba1ae3ea44 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -78,6 +78,46 @@ static int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, hw= addr iova, return ret; } =20 +static void vhost_vdpa_listener_begin(MemoryListener *listener) +{ + struct vhost_vdpa *v =3D container_of(listener, struct vhost_vdpa, lis= tener); + struct vhost_dev *dev =3D v->dev; + struct vhost_msg_v2 msg; + int fd =3D v->device_fd; + + if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { + return; + } + + msg.type =3D v->msg_type; + msg.iotlb.type =3D VHOST_IOTLB_BATCH_BEGIN; + + if (write(fd, &msg, sizeof(msg)) !=3D sizeof(msg)) { + error_report("failed to write, fd=3D%d, errno=3D%d (%s)", + fd, errno, strerror(errno)); + } +} + +static void vhost_vdpa_listener_commit(MemoryListener *listener) +{ + struct vhost_vdpa *v =3D container_of(listener, struct vhost_vdpa, lis= tener); + struct vhost_dev *dev =3D v->dev; + struct vhost_msg_v2 msg; + int fd =3D v->device_fd; + + if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { + return; + } + + msg.type =3D v->msg_type; + msg.iotlb.type =3D VHOST_IOTLB_BATCH_END; + + if (write(fd, &msg, sizeof(msg)) !=3D sizeof(msg)) { + error_report("failed to write, fd=3D%d, errno=3D%d (%s)", + fd, errno, strerror(errno)); + } +} + static void vhost_vdpa_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -191,6 +231,8 @@ static void vhost_vdpa_listener_region_del(MemoryListen= er *listener, * depends on the addnop(). */ static const MemoryListener vhost_vdpa_memory_listener =3D { + .begin =3D vhost_vdpa_listener_begin, + .commit =3D vhost_vdpa_listener_commit, .region_add =3D vhost_vdpa_listener_region_add, .region_del =3D vhost_vdpa_listener_region_del, }; @@ -226,6 +268,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void = *opaque) assert(dev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_VDPA); =20 v =3D opaque; + v->dev =3D dev; dev->opaque =3D opaque ; vhost_vdpa_call(dev, VHOST_GET_FEATURES, &features); dev->backend_features =3D features; @@ -280,6 +323,28 @@ static int vhost_vdpa_set_features(struct vhost_dev *d= ev, return !(status & VIRTIO_CONFIG_S_FEATURES_OK); } =20 +static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) +{ + uint64_t features; + uint64_t f =3D 0x1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2 | + 0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH; + int r; + + if (vhost_vdpa_call(dev, VHOST_GET_BACKEND_FEATURES, &features)) { + return 0; + } + + features &=3D f; + r =3D vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features); + if (r) { + return 0; + } + + dev->backend_cap =3D features; + + return 0; +} + int vhost_vdpa_get_device_id(struct vhost_dev *dev, uint32_t *device_id) { @@ -452,6 +517,7 @@ const VhostOps vdpa_ops =3D { .vhost_set_vring_kick =3D vhost_vdpa_set_vring_kick, .vhost_set_vring_call =3D vhost_vdpa_set_vring_call, .vhost_get_features =3D vhost_vdpa_get_features, + .vhost_set_backend_cap =3D vhost_vdpa_set_backend_cap, .vhost_set_owner =3D vhost_vdpa_set_owner, .vhost_set_vring_endian =3D NULL, .vhost_backend_memslots_limit =3D vhost_vdpa_memslots_limit, --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446416; cv=none; d=zohomail.com; s=zohoarc; b=G0JcDChT4L0GfhqGDEXilDXNtMQeN92s/NOzMGeCqDfcDV0SEjrHmN9ISbgslMwZaNt49JdD7Qf2LrOO30XHiBEqabCe7y1A25ZnVMPmQx7FQ8Nm+QqWX0r7JLoeJweNNMDy8sVr/u0mMx+ktgg5YPKOYQYi0jEaSu40ErWGvrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446416; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Msq8goiUIrREy947KknDtEH1ZqD2k0E/AfsZQGv/SGY=; b=lqmsDukkYXl1D5J2eP8o5f4NpjpMIEFNycpGC/2i3eHASLURXM/0HPA2UQx/uUd6wRm248KSZpLCoQzCE78Mu1huh3Ja+WBzCjDkLsn8AEhFaGWXy59w2lyrEgxvU0QkzUMyGCb8WK0wHwm8bqvQfyOYNpj2onf3qhDAGyqjjY0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600446416970564.4846548484342; Fri, 18 Sep 2020 09:26:56 -0700 (PDT) Received: from localhost ([::1]:33894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJDr-0002RT-Np for importer@patchew.org; Fri, 18 Sep 2020 12:26:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7V-000529-Jv for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45034) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7P-0005ZG-Oc for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:20 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-AnfN_2rcMBuAKsYqbB7ITg-1; Fri, 18 Sep 2020 12:20:11 -0400 Received: by mail-wm1-f69.google.com with SMTP id a7so2245111wmc.2 for ; Fri, 18 Sep 2020 09:20:11 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id z127sm6019969wmc.2.2020.09.18.09.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Msq8goiUIrREy947KknDtEH1ZqD2k0E/AfsZQGv/SGY=; b=I5QHkSZaHlKk+/2sSP77MqnXyWO7yTsOMnpAQrMVfQuGua3fPzneWNLkdkK7C4/n9ZAbNh XXk6P9Y/OmbUPYCmoA0QTxrRzDGM3+pa5kF/UhtZhrOyVv1LzhwFlnrpZDFw5ju5UkA+hT WYKlz3gfysa5fEAOhvbnJuDmNhse5no= X-MC-Unique: AnfN_2rcMBuAKsYqbB7ITg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Msq8goiUIrREy947KknDtEH1ZqD2k0E/AfsZQGv/SGY=; b=Jevpug76S7co2rQlXwxl/g2OCPcmHrj26UiRRKapj+D2PKpNyXrRCVkJrN5dkLh0xe SAfPhxX1lfl7Hi2UIAchvAMLetiQE2fEf52KA5MFEDp0Rz8H0o651tyfRjG/hQ9c6Hp2 HFPd2sRUKpd62fEgs4hEI279dp/PpGURvjD8C62HSj9cTJJM00S4+zXPx2fayUkw1ZKR +dFU1KRNiXRWCnR9y1tFDD1CFUowcWYvR3yNroqC6i8zDB3viHx2FLOcTRZEA68eZkr0 GcENE84rfyPolCWxq4Op5rj30jDlvo3ggvEN1E+EnnYUj1IVdurtdFWt5w31e3I5sv6w fHZg== X-Gm-Message-State: AOAM532DddzKed9kh1BH6DqoCDJPCVSKJzLRCHC3m4BHDfG9gDC11wXQ n9ZV2NlN+2CuCYwRZetlgFRCHYFEblb4Y+7VB4l8ZTZcbYdWBrIni37rWPjlCBTQXteR2fiGs4N 5YbqDUmMd7h1bcFY= X-Received: by 2002:a1c:f208:: with SMTP id s8mr16979335wmc.85.1600446009655; Fri, 18 Sep 2020 09:20:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymlaLUhEcBc2Kkg7rrEvpgtXS1Urt7OPkfWifR+13AjZ97NNKcWZHs+CGELURdy1kMd5MovA== X-Received: by 2002:a1c:f208:: with SMTP id s8mr16979322wmc.85.1600446009489; Fri, 18 Sep 2020 09:20:09 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 04/15] virtio-mem: detach the element from the virtqueue when error occurs Message-ID: <20200918161836.318893-5-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Li Qiang , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Qiang If error occurs while processing the virtio request we should call 'virtqueue_detach_element' to detach the element from the virtqueue before free the elem. Signed-off-by: Li Qiang Message-Id: <20200816142245.17556-1-liq3ea@163.com> Fixes: 910b25766b ("virtio-mem: Paravirtualized memory hot(un)plug") Acked-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-mem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 8fbec77ccc..7c8ca9f28b 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -318,6 +318,7 @@ static void virtio_mem_handle_request(VirtIODevice *vde= v, VirtQueue *vq) if (iov_to_buf(elem->out_sg, elem->out_num, 0, &req, len) < len) { virtio_error(vdev, "virtio-mem protocol violation: invalid req= uest" " size: %d", len); + virtqueue_detach_element(vq, elem, 0); g_free(elem); return; } @@ -327,6 +328,7 @@ static void virtio_mem_handle_request(VirtIODevice *vde= v, VirtQueue *vq) virtio_error(vdev, "virtio-mem protocol violation: not enough = space" " for response: %zu", iov_size(elem->in_sg, elem->in_num)); + virtqueue_detach_element(vq, elem, 0); g_free(elem); return; } @@ -348,6 +350,7 @@ static void virtio_mem_handle_request(VirtIODevice *vde= v, VirtQueue *vq) default: virtio_error(vdev, "virtio-mem protocol violation: unknown req= uest" " type: %d", type); + virtqueue_detach_element(vq, elem, 0); g_free(elem); return; } --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447621; cv=none; d=zohomail.com; s=zohoarc; b=TAMhiCxSEY9TIapDIsV95dV9N9wnlqbArNfYbk2CfEATxXMhcWVZTkIomk6NePU1LWOsNKbSPZqjfR078GeQ5zcfAl+XDyc6hhUp4AaREXcPCPqWbhYPGElRyEC2zNbtci05SMyvqTDDTEJor2/PEEBeTodK6D56+b9h0vgCiKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447621; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5hYvdz2qitSdqwuTuePQGMPUpQ1ZwS4Y5kaurOk3sFU=; b=LM5CCm0lIhJdqG9Pd1yHsp7w9iPqMGhYWBuQckUGRQbwQs97LwyOmlEVmL1dm3I4tXDyEFDGbU9OCLxm+NO+AEHM1vYIw1bJsftVuctjAdLsSErY2C+vGTqW/PPOImctiMq6Y/fOhtcjEG2ufn42CgtL/W51H2LLBx+J8bCQwp4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447621819700.2641259980815; Fri, 18 Sep 2020 09:47:01 -0700 (PDT) Received: from localhost ([::1]:48308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJXI-00043f-I4 for importer@patchew.org; Fri, 18 Sep 2020 12:47:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7a-00053d-ER for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7U-0005bN-UZ for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:26 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-3_sXm3E5Oz-G1hqbbmqgww-1; Fri, 18 Sep 2020 12:20:14 -0400 Received: by mail-wr1-f72.google.com with SMTP id a10so2293602wrw.22 for ; Fri, 18 Sep 2020 09:20:14 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id a5sm5930224wrp.37.2020.09.18.09.20.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5hYvdz2qitSdqwuTuePQGMPUpQ1ZwS4Y5kaurOk3sFU=; b=aChkVy1GmrpxXFERygWpE8Ys6loRmVFCYvvgpHWS4jRMX2hXcBMQd4IWdsJ0KcvoqO4LhY sJLDeU3WtW1cAEynVXocXrpLq2XjXABAs85+9+rRKjIEsFdNW/88rpTWhqFeKTY2zuRQPf 1q03jo9toEh7ymyLL5rKiC3diFtXMdg= X-MC-Unique: 3_sXm3E5Oz-G1hqbbmqgww-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5hYvdz2qitSdqwuTuePQGMPUpQ1ZwS4Y5kaurOk3sFU=; b=eRvq3CUGBokn8GlJgAFgKAf3Groq2r2FLEnpamtrSeTNG6DdQvbvh0TiRomMrsAdES Ie+CjHCwJNZtSV/i1zyko3o1jSJTdtU8VLMkEt+ro5eTwhTWxz3q2sxG+aXei6MDR3hx 5KBajVTqhgPKIVEyoI/PYimTfWf4Ug9aVGPtd3Izrw3akxKRCRPT+ExEqrM2hGAen9eN C1SL5+5swiuHzDZJ9joPgH1bNnjTsIRbsB/+TfaX5rhVV4WWzRpfm+YoiIDIWuM4XtLg JTJ1bRUKMqZ0gE28Is7NIpJJSihVN5fKCMxS6xg+HcZrXNXA4sfa/33i2TBeD1I+hgEA DnKg== X-Gm-Message-State: AOAM533s6kwom2lRGxyQsHxQkCBIw5wHtqFCJvQEN7ks0jykqpOXlu+s 2awOywN18L2fTip01YPM3brj/DRP2nZSk9w6rHtZdIgI1s0cBYRhPDwp8u+COJ44LwT/dGuCt1S 5rMaLXsXJa9e+Sbw= X-Received: by 2002:a1c:7f14:: with SMTP id a20mr16644737wmd.95.1600446012936; Fri, 18 Sep 2020 09:20:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1ApR7ml4x6BT92Um9hjUsj5pB0B2DKOU7ujzlT8t9p8HNEdkjq7AQtqKVM+LzMsz4LW7kOw== X-Received: by 2002:a1c:7f14:: with SMTP id a20mr16644719wmd.95.1600446012767; Fri, 18 Sep 2020 09:20:12 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 05/15] pc: fix auto_enable_numa_with_memhp/auto_enable_numa_with_memdev for the 5.0 machine Message-ID: <20200918161836.318893-6-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, "Dr . David Alan Gilbert" , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Unfortunately, a typo sneeked in: we want to set auto_enable_numa_with_memdev to false, not auto_enable_numa_with_memhp. Cc: qemu-stable@nongnu.org # v5.1 Fixes: 195784a0cfad (numa: Auto-enable NUMA when any memory devices are pos= sible) Reported-by: Dr. David Alan Gilbert Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand Message-Id: <20200820094828.30348-1-david@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_q35.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 622d039717..e1c415f57d 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -382,7 +382,7 @@ static void pc_q35_5_0_machine_options(MachineClass *m) m->numa_mem_supported =3D true; compat_props_add(m->compat_props, hw_compat_5_0, hw_compat_5_0_len); compat_props_add(m->compat_props, pc_compat_5_0, pc_compat_5_0_len); - m->auto_enable_numa_with_memhp =3D false; + m->auto_enable_numa_with_memdev =3D false; } =20 DEFINE_Q35_MACHINE(v5_0, "pc-q35-5.0", NULL, --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447076; cv=none; d=zohomail.com; s=zohoarc; b=fE20l6V2isU2zVt0Gd2LJVtXeuITuZZnqSghT5Qw/f2BYxmp1kzx4H5c41yaigLMjPPu9TZy8YMGzeiW6zgHJTZ/B7j/xE4R6uH9LTrr4gqhyUcUyPGqSAZ95V20VDXTTzDP4pl6r0uoyj4Hw7kzPo3rxVhC2h8y+5EazNzHqqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447076; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oO9eeSTOhXhb/ICfMDRNeszMFF9HmLKnPc0ew6L2QLY=; b=mulFuj6HzA/X62/TY4ZEhL4Hs5Iyw1oQW8DiuCU3wXhf66gQ5CvD5Eya1sf0cSUIX152SVqYYeX5cQEH02AAmgnGAp8uq9yKf/Agy+TApRYBJ66zquiM+ZXkQWEbymsa3QRVgqUjXHBYfvBq1wjPJwvRkp1pqAztm87WLVOmLdA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16004470768431021.5606355304001; Fri, 18 Sep 2020 09:37:56 -0700 (PDT) Received: from localhost ([::1]:54348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJOU-0003Gj-Fe for importer@patchew.org; Fri, 18 Sep 2020 12:37:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7f-0005B0-F6 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50275 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7d-0005jQ-Hi for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:31 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-mkBHqEksNrqgyarev1jQ-w-1; Fri, 18 Sep 2020 12:20:19 -0400 Received: by mail-wm1-f72.google.com with SMTP id l15so2235697wmh.9 for ; Fri, 18 Sep 2020 09:20:19 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id u17sm5769693wmm.4.2020.09.18.09.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oO9eeSTOhXhb/ICfMDRNeszMFF9HmLKnPc0ew6L2QLY=; b=WytT2I6A8pwVbg+1PyLABMdRHQfkqDdQcqQSGGJjcXwvXWxg2+NJR4oiHAIfFRKZ/mUtWs jblE4aJLWWJe7WvPnvUFm8JbJ4RYJh7rdtij21Ey6TqjPKpwvs6oAde7LU6XnnVHcuxwAW TKwsD86AnECfwgonSQaUhJozDy+Xyhc= X-MC-Unique: mkBHqEksNrqgyarev1jQ-w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oO9eeSTOhXhb/ICfMDRNeszMFF9HmLKnPc0ew6L2QLY=; b=X4U+3sB94R7ZNGJXC+nH0kOsdJS9+P6TVRdrZCSj/cLfwxrJGuOS0Zmtxxarl4Vff0 cxgZ/awHlbZpd7j+dJJ/wfFaaoNaUaFhPOf7iY+fG02QfJr8W3bt7EvXDOOz6csg+bH4 s5Jtb6AJ2y8WukYzSeXHJ/R5T/U8GcESQWrd+WoeQ4fA3+uixgIq+0jxYyGR2cF+bsl+ Ei1yJ91iur+BLE0YcjfvxBV2afcRrdJ2K6QAd1W4rkI0ywtKxR6cNbozbXkVFxqGFgVf kGhThBcdxqz+BUqbI6qHUeLm88/E6C/Lx5GvM6xog1AnqCUn0ntso3cxVO9F/4IjT5BD GfqA== X-Gm-Message-State: AOAM533Yv44CUhaWL6KGlWMMwKf+lCm4GeHEyKn5biDSiBrQNWWcA75Q bMe4byL+Uigqninrfig8H3tCEyRIO+EswEcxtszGhB2ilnxBi0c1io1yeNqqu2qFoy44X/AIWU2 OVjOpajab3QSZm7Q= X-Received: by 2002:adf:c5c3:: with SMTP id v3mr15787303wrg.205.1600446016236; Fri, 18 Sep 2020 09:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7OyOvuXLGeU3QxVE0tp383imuZn3qb8l+9L35Ns7F9/LHmPJRSiP6YIol7INtxPD/FdIzBw== X-Received: by 2002:adf:c5c3:: with SMTP id v3mr15787265wrg.205.1600446015941; Fri, 18 Sep 2020 09:20:15 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/15] vhost: recheck dev state in the vhost_migration_log routine Message-ID: <20200918161836.318893-7-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 03:47:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Max Reitz , Raphael Norwitz , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov vhost-user devices can get a disconnect in the middle of the VHOST-USER handshake on the migration start. If disconnect event happened right before sending next VHOST-USER command, then the vhost_dev_set_log() call in the vhost_migration_log() function will return error. This error will lead to the assert() and close the QEMU migration source process. For the vhost-user devices the disconnect event should not break the migration process, because: - the device will be in the stopped state, so it will not be changed during migration - if reconnect will be made the migration log will be reinitialized as part of reconnect/init process: #0 vhost_log_global_start (listener=3D0x563989cf7be0) at hw/virtio/vhost.c:920 #1 0x000056398603d8bc in listener_add_address_space (listener=3D0x5639= 89cf7be0, as=3D0x563986ea4340 ) at softmmu/memory.c:2664 #2 0x000056398603dd30 in memory_listener_register (listener=3D0x563989= cf7be0, as=3D0x563986ea4340 ) at softmmu/memory.c:2740 #3 0x0000563985fd6956 in vhost_dev_init (hdev=3D0x563989cf7bd8, opaque=3D0x563989cf7e30, backend_type=3DVHOST_BACKEND_TYPE_USER, busyloop_timeout=3D0) at hw/virtio/vhost.c:1385 #4 0x0000563985f7d0b8 in vhost_user_blk_connect (dev=3D0x563989cf7990) at hw/block/vhost-user-blk.c:315 #5 0x0000563985f7d3f6 in vhost_user_blk_event (opaque=3D0x563989cf7990, event=3DCHR_EVENT_OPENED) at hw/block/vhost-user-blk.c:379 Update the vhost-user-blk device with the internal started_vu field which will be used for initialization (vhost_user_blk_start) and clean up (vhost_user_blk_stop). This additional flag in the VhostUserBlk structure will be used to track whether the device really needs to be stopped and cleaned up on a vhost-user level. The disconnect event will set the overall VHOST device (not vhost-user) to the stopped state, so it can be used by the general vhost_migration_log routine. Such approach could be propogated to the other vhost-user devices, but better idea is just to make the same connect/disconnect code for all the vhost-user devices. This migration issue was slightly discussed earlier: - https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg01509.html - https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg05241.html Signed-off-by: Dima Stepanov Reviewed-by: Raphael Norwitz Message-Id: <9fbfba06791a87813fcee3e2315f0b904cc6789a.1599813294.git.dimast= ep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-blk.h | 10 ++++++++++ hw/block/vhost-user-blk.c | 19 ++++++++++++++++--- hw/virtio/vhost.c | 27 ++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index dc40ab6f11..5d86ff2e87 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -42,7 +42,17 @@ struct VHostUserBlk { VhostUserState vhost_user; struct vhost_virtqueue *vhost_vqs; VirtQueue **virtqs; + + /* + * There are at least two steps of initialization of the + * vhost-user device. The first is a "connect" step and + * second is a "start" step. Make a separation between + * those initialization phases by using two fields. + */ + /* vhost_user_blk_connect/vhost_user_blk_disconnect */ bool connected; + /* vhost_user_blk_start/vhost_user_blk_stop */ + bool started_vu; }; =20 #endif diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 39aec42dae..a076b1e54d 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -150,6 +150,7 @@ static int vhost_user_blk_start(VirtIODevice *vdev) error_report("Error starting vhost: %d", -ret); goto err_guest_notifiers; } + s->started_vu =3D true; =20 /* guest_notifier_mask/pending not used yet, so just unmask * everything here. virtio-pci will do the right thing by @@ -175,6 +176,11 @@ static void vhost_user_blk_stop(VirtIODevice *vdev) VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); int ret; =20 + if (!s->started_vu) { + return; + } + s->started_vu =3D false; + if (!k->set_guest_notifiers) { return; } @@ -341,9 +347,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev) } s->connected =3D false; =20 - if (s->dev.started) { - vhost_user_blk_stop(vdev); - } + vhost_user_blk_stop(vdev); =20 vhost_dev_cleanup(&s->dev); } @@ -399,6 +403,15 @@ static void vhost_user_blk_event(void *opaque, QEMUChr= Event event) NULL, NULL, false); aio_bh_schedule_oneshot(ctx, vhost_user_blk_chr_closed_bh, opa= que); } + + /* + * Move vhost device to the stopped state. The vhost-user device + * will be clean up and disconnected in BH. This can be useful in + * the vhost migration code. If disconnect was caught there is an + * option for the general vhost code to get the dev state without + * knowing its type (in this case vhost-user). + */ + s->dev.started =3D false; break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index e986bf53e4..1b2d735b54 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -871,21 +871,42 @@ static int vhost_migration_log(MemoryListener *listen= er, bool enable) dev->log_enabled =3D enable; return 0; } + + r =3D 0; if (!enable) { r =3D vhost_dev_set_log(dev, false); if (r < 0) { - return r; + goto check_dev_state; } vhost_log_put(dev, false); } else { vhost_dev_log_resize(dev, vhost_get_log_size(dev)); r =3D vhost_dev_set_log(dev, true); if (r < 0) { - return r; + goto check_dev_state; } } + +check_dev_state: dev->log_enabled =3D enable; - return 0; + /* + * vhost-user-* devices could change their state during log + * initialization due to disconnect. So check dev state after + * vhost communication. + */ + if (!dev->started) { + /* + * Since device is in the stopped state, it is okay for + * migration. Return success. + */ + r =3D 0; + } + if (r) { + /* An error is occured. */ + dev->log_enabled =3D false; + } + + return r; } =20 static void vhost_log_global_start(MemoryListener *listener) --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446692; cv=none; d=zohomail.com; s=zohoarc; b=OcpR0Ve6ImnBbS3AqmEAt6ZcmSY1cJgbrMCF+Uu5muN2LaKb8d/AhU46HlbT3Np5haMroselEwQme/2r1x318yFW8Gs6wbLivwfo548tGXGYOLzuVHekSYLUKYqlnfUn+S70XFCTfRT9XlCh3yIYMHfSVkeHS5Lr+C+92kEkON0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446692; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zU1UuXmYbLJaJZ3QFezYItjoYd07TLF83B1qBr2RadM=; b=JrY1k6pWe/49HawEO3dXvLrz5YMyx10j8a+OlSTYlAaDaTUEf5k3w/qVy79GIqFnWsLqn5fhEZi9KPIo+ceB32ynb2a70vY52ybkcXbt86JaZY+Sim3V2wBDyp3KseMfVRtmxl4ZtjZrhPFzosuCo2f4rPXHBQkuZ3TtYYkxpaI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600446692753568.0405756406549; Fri, 18 Sep 2020 09:31:32 -0700 (PDT) Received: from localhost ([::1]:42176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJIJ-00066M-Cx for importer@patchew.org; Fri, 18 Sep 2020 12:31:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7b-00054V-Rl for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7a-0005g0-1j for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:27 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-NlVKJQxVNBOdpcplvQxW5w-1; Fri, 18 Sep 2020 12:20:21 -0400 Received: by mail-wm1-f72.google.com with SMTP id a7so2245299wmc.2 for ; Fri, 18 Sep 2020 09:20:20 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id l10sm5788364wmh.27.2020.09.18.09.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zU1UuXmYbLJaJZ3QFezYItjoYd07TLF83B1qBr2RadM=; b=gGfwK1MAbZ369zFCW1TEg/3BW8DV8ehiZK+cOdjoAGQQB49JqwjaWLsPL7w6eR+7pjYAYr XI3agc8b1hginA+V0M0PNFPib14MwZxVfq0x6ZTkeDWSHJ995ljVlohEXLiaBU7JfZpQ62 Nsm7glKXC/e0Q5tGsE0aTtVK3tbCvXc= X-MC-Unique: NlVKJQxVNBOdpcplvQxW5w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zU1UuXmYbLJaJZ3QFezYItjoYd07TLF83B1qBr2RadM=; b=a5XgMAhpCZNCvnwRKj4FnEG7IkntEpGs+ZJbKvmnK0duqwwyXoQjGdHBl3gaUD99oJ Z83NjlCi3W4ErRdAJD/ofrB1yV6zlkWC3ZDOktZWafCNNlLHM68kDTa0QH3HedzA0654 RZQ38km8CXrXrby3eX+yMmZgAzaHgx63V4kwEEMA1wbDSV5kw4rcmqo9gPhwIvjqOLKF xaxLqMPGpKtNWJYibbbsvPHRjqiyJ4bvYbmxtHGrVIHgU692Vk4mIpYGKMMxn5QFLLzg JaGn72hk7IAB7o/CpWlu+mIxXPiWrZH+J4WjHUsTuKXscD7vX/HjwKT25U7zAfRo473x A+lQ== X-Gm-Message-State: AOAM533qozixLWiXUeZlL71CLQtgMM9EzkOEYSp/pSkHf1Lh1Z3YcuVK ncqcf1oa09+MB2PCywQkQtfHvzSZbRg6ryxp+GA7sjPdi0XTr7zkCX6Qg/JVawtIi9W0Lg+x6qK AewFp24xQTaL7VMw= X-Received: by 2002:a05:600c:252:: with SMTP id 18mr15393289wmj.63.1600446019265; Fri, 18 Sep 2020 09:20:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdEJwP8cWRridimELEROz+TLBXqSVzTljEw/v/N8HgUwH4ImJTUd8TzXfsCdKWMyAegyWVFw== X-Received: by 2002:a05:600c:252:: with SMTP id 18mr15393275wmj.63.1600446019075; Fri, 18 Sep 2020 09:20:19 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 07/15] vhost: check queue state in the vhost_dev_set_log routine Message-ID: <20200918161836.318893-8-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Dima Stepanov , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov If the vhost-user-blk daemon provides only one virtqueue, but device was added with several queues, then QEMU will send more VHOST-USER command than expected by daemon side. The vhost_virtqueue_start() routine handles such case by checking the return value from the virtio_queue_get_desc_addr() function call. Add the same check to the vhost_dev_set_log() routine. Signed-off-by: Dima Stepanov Reviewed-by: Raphael Norwitz Message-Id: <6232946d5af09e9775076645909964a6539b8ab5.1599813294.git.dimast= ep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 1b2d735b54..7c9542b1f6 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -835,12 +835,24 @@ out: static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log) { int r, i, idx; + hwaddr addr; + r =3D vhost_dev_set_features(dev, enable_log); if (r < 0) { goto err_features; } for (i =3D 0; i < dev->nvqs; ++i) { idx =3D dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i); + addr =3D virtio_queue_get_desc_addr(dev->vdev, idx); + if (!addr) { + /* + * The queue might not be ready for start. If this + * is the case there is no reason to continue the process. + * The similar logic is used by the vhost_virtqueue_start() + * routine. + */ + continue; + } r =3D vhost_virtqueue_set_addr(dev, dev->vqs + i, idx, enable_log); if (r < 0) { --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447745; cv=none; d=zohomail.com; s=zohoarc; b=OPmuEFQKzKGI0yDju3tOl1TgT5wwhwW8gBLgpagIpuC6LF+LufHmsRyZ7asb3/IHqIHbHc1gx7kKH10Vw8iPBsnHhYW3+02kti+lM7g5kJMuzqsmRd9lvx0MFbKNdElFmycsLqPQxAERPVTA/bXBEWEFY+aNzUaglgkedJ9FtmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447745; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gyuuZ4Sz8ayGeGEwQkqastteCZWQE5SL9GYanhN/cu8=; b=kXRIyTf/2tH1yRNYkZPCIJecyGOCZPavV6a4d00NbnFdrLrSZ7Jrcb99FCYjiT55ekvUAzilcPVf3HCExEtARR0mVYb44doX8fq5wOvYpve3sBpV3tJxt5OZTURNC60fukIyX0gPfIZIga82XUusZ1wFYtT7YWyzOlsywFm+1EE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447745559446.05069564482915; Fri, 18 Sep 2020 09:49:05 -0700 (PDT) Received: from localhost ([::1]:52634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJZI-0005tm-3x for importer@patchew.org; Fri, 18 Sep 2020 12:49:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7d-000577-FK for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23065 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7b-0005ht-7U for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:29 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-557-xz13OE5bPjOvSq9Gfkg1EA-1; Fri, 18 Sep 2020 12:20:23 -0400 Received: by mail-wm1-f69.google.com with SMTP id w3so2242905wmg.4 for ; Fri, 18 Sep 2020 09:20:23 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id o15sm5604768wmh.29.2020.09.18.09.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gyuuZ4Sz8ayGeGEwQkqastteCZWQE5SL9GYanhN/cu8=; b=OrLZX9ZeotS65ZTVm4bFsdaK+NmbiOxQvMyNvP8pygqchqgJwb98CFW659V5TEPUnhktoF iPgywb8J/qg7jdWCKICnsdwygXmtiTQ+rRB/vj269rxxj7LelcYpE+3uEqYS1ZNWx9m6fy gvXfu6j0wa3CQwLI1AnTVizYnUo4Zg4= X-MC-Unique: xz13OE5bPjOvSq9Gfkg1EA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gyuuZ4Sz8ayGeGEwQkqastteCZWQE5SL9GYanhN/cu8=; b=slJoRpNEduXK+JkdngMcHdX1e5bacWu91IhFKECBhNmJl/65H9kBes9APE3E+OH2yM DrXFDVIVyr6g/CFu2k8PSa7zubF3iY9J5ZPcFcrrFdaJdyj8O/mxqW/E9Wi0W8/Lh4us DPH8e8i00JbCeWp9W7Qg0MSGJXJFJao8/ryceHSpKI3UyH7q6AoJ4hpcECQeIZLUOLgF T7xifK4jESM7D1ftxFqrsKIwReMFb7utOTjlvJ+ibxKqyB9WaWTdiW9U0VjAW35AB/Te NRw70zoFxXZivEjBK0NYqFIE4PX/PpzYzGQ0y6z3ibHGg7JNTeCSb7LHb4LGASpLUikc 4GTQ== X-Gm-Message-State: AOAM530gkYSpk3pcz+rfUWfFRd24jXvMw1s9Km2t5TGwjtqX9eti+vLR UOOpTaorAdqsXmKcfGckrCCVR6bLa0E0b2FoqA37KU8wbep/+nGHtRym0iNoE5793x6ar9jRy+Z yrK9E5JplLJiyPY8= X-Received: by 2002:a1c:96:: with SMTP id 144mr16465888wma.84.1600446022151; Fri, 18 Sep 2020 09:20:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCnd1cPN5DzXVivE9FUlCePK5vrajlZZl8i/znXLCpZyPK+3qNcJZgb27qyKuMBuQH/S85+Q== X-Received: by 2002:a1c:96:: with SMTP id 144mr16465862wma.84.1600446021864; Fri, 18 Sep 2020 09:20:21 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:19 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 08/15] tests/qtest/vhost-user-test: prepare the tests for adding new dev class Message-ID: <20200918161836.318893-9-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 03:47:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Raphael Norwitz , Paolo Bonzini , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov For now only vhost-user-net device is supported by the test. Other vhost-user devices are not tested. As a first step make source code refactoring so new devices can reuse the same test routines. To make this provide a new vhost_user_ops structure with the methods to initialize device, its command line or make a proper vhost-user responses. Signed-off-by: Dima Stepanov Reviewed-by: Raphael Norwitz Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 105 ++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 9ee0f1e4fd..3df5322614 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -135,6 +135,10 @@ enum { TEST_FLAGS_END, }; =20 +enum { + VHOST_USER_NET, +}; + typedef struct TestServer { gchar *socket_path; gchar *mig_path; @@ -154,10 +158,25 @@ typedef struct TestServer { bool test_fail; int test_flags; int queues; + struct vhost_user_ops *vu_ops; } TestServer; =20 +struct vhost_user_ops { + /* Device types. */ + int type; + void (*append_opts)(TestServer *s, GString *cmd_line, + const char *chr_opts); + + /* VHOST-USER commands. */ + void (*set_features)(TestServer *s, CharBackend *chr, + VhostUserMsg *msg); + void (*get_protocol_features)(TestServer *s, + CharBackend *chr, VhostUserMsg *msg); +}; + static const char *init_hugepagefs(void); -static TestServer *test_server_new(const gchar *name); +static TestServer *test_server_new(const gchar *name, + struct vhost_user_ops *ops); static void test_server_free(TestServer *server); static void test_server_listen(TestServer *server); =20 @@ -167,7 +186,7 @@ enum test_memfd { TEST_MEMFD_NO, }; =20 -static void append_vhost_opts(TestServer *s, GString *cmd_line, +static void append_vhost_net_opts(TestServer *s, GString *cmd_line, const char *chr_opts) { g_string_append_printf(cmd_line, QEMU_CMD_CHR QEMU_CMD_NETDEV, @@ -332,25 +351,15 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) break; =20 case VHOST_USER_SET_FEATURES: - g_assert_cmpint(msg.payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL= _FEATURES), - !=3D, 0ULL); - if (s->test_flags =3D=3D TEST_FLAGS_DISCONNECT) { - qemu_chr_fe_disconnect(chr); - s->test_flags =3D TEST_FLAGS_BAD; + if (s->vu_ops->set_features) { + s->vu_ops->set_features(s, chr, &msg); } break; =20 case VHOST_USER_GET_PROTOCOL_FEATURES: - /* send back features to qemu */ - msg.flags |=3D VHOST_USER_REPLY_MASK; - msg.size =3D sizeof(m.payload.u64); - msg.payload.u64 =3D 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; - msg.payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; - if (s->queues > 1) { - msg.payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_MQ; + if (s->vu_ops->get_protocol_features) { + s->vu_ops->get_protocol_features(s, chr, &msg); } - p =3D (uint8_t *) &msg; - qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; =20 case VHOST_USER_GET_VRING_BASE: @@ -467,7 +476,8 @@ static const char *init_hugepagefs(void) #endif } =20 -static TestServer *test_server_new(const gchar *name) +static TestServer *test_server_new(const gchar *name, + struct vhost_user_ops *ops) { TestServer *server =3D g_new0(TestServer, 1); char template[] =3D "/tmp/vhost-test-XXXXXX"; @@ -495,6 +505,7 @@ static TestServer *test_server_new(const gchar *name) =20 server->log_fd =3D -1; server->queues =3D 1; + server->vu_ops =3D ops; =20 return server; } @@ -669,11 +680,11 @@ static void vhost_user_test_cleanup(void *s) =20 static void *vhost_user_test_setup(GString *cmd_line, void *arg) { - TestServer *server =3D test_server_new("vhost-user-test"); + TestServer *server =3D test_server_new("vhost-user-test", arg); test_server_listen(server); =20 append_mem_opts(server, cmd_line, 256, TEST_MEMFD_AUTO); - append_vhost_opts(server, cmd_line, ""); + server->vu_ops->append_opts(server, cmd_line, ""); =20 g_test_queue_destroy(vhost_user_test_cleanup, server); =20 @@ -682,11 +693,11 @@ static void *vhost_user_test_setup(GString *cmd_line,= void *arg) =20 static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg) { - TestServer *server =3D test_server_new("vhost-user-test"); + TestServer *server =3D test_server_new("vhost-user-test", arg); test_server_listen(server); =20 append_mem_opts(server, cmd_line, 256, TEST_MEMFD_YES); - append_vhost_opts(server, cmd_line, ""); + server->vu_ops->append_opts(server, cmd_line, ""); =20 g_test_queue_destroy(vhost_user_test_cleanup, server); =20 @@ -720,7 +731,7 @@ static void test_migrate(void *obj, void *arg, QGuestAl= locator *alloc) return; } =20 - dest =3D test_server_new("dest"); + dest =3D test_server_new("dest", s->vu_ops); dest_cmdline =3D g_string_new(qos_get_current_command_line()); uri =3D g_strdup_printf("%s%s", "unix:", dest->mig_path); =20 @@ -730,7 +741,7 @@ static void test_migrate(void *obj, void *arg, QGuestAl= locator *alloc) test_server_listen(dest); g_string_append_printf(dest_cmdline, " -incoming %s", uri); append_mem_opts(dest, dest_cmdline, 256, TEST_MEMFD_AUTO); - append_vhost_opts(dest, dest_cmdline, ""); + dest->vu_ops->append_opts(dest, dest_cmdline, ""); to =3D qtest_init(dest_cmdline->str); =20 /* This would be where you call qos_allocate_objects(to, NULL), if you= want @@ -831,11 +842,11 @@ connect_thread(gpointer data) =20 static void *vhost_user_test_setup_reconnect(GString *cmd_line, void *arg) { - TestServer *s =3D test_server_new("reconnect"); + TestServer *s =3D test_server_new("reconnect", arg); =20 g_thread_new("connect", connect_thread, s); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); - append_vhost_opts(s, cmd_line, ",server"); + s->vu_ops->append_opts(s, cmd_line, ",server"); =20 g_test_queue_destroy(vhost_user_test_cleanup, s); =20 @@ -866,13 +877,13 @@ static void test_reconnect(void *obj, void *arg, QGue= stAllocator *alloc) =20 static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *a= rg) { - TestServer *s =3D test_server_new("connect-fail"); + TestServer *s =3D test_server_new("connect-fail", arg); =20 s->test_fail =3D true; =20 g_thread_new("connect", connect_thread, s); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); - append_vhost_opts(s, cmd_line, ",server"); + s->vu_ops->append_opts(s, cmd_line, ",server"); =20 g_test_queue_destroy(vhost_user_test_cleanup, s); =20 @@ -881,13 +892,13 @@ static void *vhost_user_test_setup_connect_fail(GStri= ng *cmd_line, void *arg) =20 static void *vhost_user_test_setup_flags_mismatch(GString *cmd_line, void = *arg) { - TestServer *s =3D test_server_new("flags-mismatch"); + TestServer *s =3D test_server_new("flags-mismatch", arg); =20 s->test_flags =3D TEST_FLAGS_DISCONNECT; =20 g_thread_new("connect", connect_thread, s); append_mem_opts(s, cmd_line, 256, TEST_MEMFD_AUTO); - append_vhost_opts(s, cmd_line, ",server"); + s->vu_ops->append_opts(s, cmd_line, ",server"); =20 g_test_queue_destroy(vhost_user_test_cleanup, s); =20 @@ -924,11 +935,47 @@ static void test_multiqueue(void *obj, void *arg, QGu= estAllocator *alloc) wait_for_rings_started(s, s->queues * 2); } =20 +static void vu_net_set_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + g_assert_cmpint(msg->payload.u64 & + (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=3D, 0ULL); + if (s->test_flags =3D=3D TEST_FLAGS_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags =3D TEST_FLAGS_BAD; + } +} + +static void vu_net_get_protocol_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + /* send back features to qemu */ + msg->flags |=3D VHOST_USER_REPLY_MASK; + msg->size =3D sizeof(m.payload.u64); + msg->payload.u64 =3D 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg->payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; + if (s->queues > 1) { + msg->payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_MQ; + } + qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->= size); +} + +/* Each VHOST-USER device should have its ops structure defined. */ +static struct vhost_user_ops g_vu_net_ops =3D { + .type =3D VHOST_USER_NET, + + .append_opts =3D append_vhost_net_opts, + + .set_features =3D vu_net_set_features, + .get_protocol_features =3D vu_net_get_protocol_features, +}; + static void register_vhost_user_test(void) { QOSGraphTestOptions opts =3D { .before =3D vhost_user_test_setup, .subprocess =3D true, + .arg =3D &g_vu_net_ops, }; =20 qemu_add_opts(&qemu_chardev_opts); --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446402; cv=none; d=zohomail.com; s=zohoarc; b=JGzSu4VAXZFDGw+o+4iqB4vPEPoQEP634TxUq3273B1mE2BauiDvMmU/i8/NIjElfkmwZC+i9Jawh9I55PGVvNR3+aodDVWsyAYmNvs83Y3W9NsN5STub66pz9llS4wNYhdgXYkSZ1+C/uJO9nKNIb3MJlhjAcP+kiJSU8xnLAE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446402; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cQLHX1DoJKJj5W3DVopK1pVavkbFhdLI78v3G2Q4YW4=; b=LubOI7+FFyDyPYpP2KxHqjcYRAiHzkdpm1FOg+TNq9mGoGl2nuYhexpTB4ByTE/UeE2NckvrIkpUUXrzbQ42fCeSQT4HYaxPxCloK/9bgpbtcY/GC/HHKSqq5GRCRH0eiZU5DbQhk0H8ZLrO0OMQZCuKT0f1XP5Ay9k2EmcZnYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600446402126501.94452681461667; Fri, 18 Sep 2020 09:26:42 -0700 (PDT) Received: from localhost ([::1]:32926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJDc-000231-A6 for importer@patchew.org; Fri, 18 Sep 2020 12:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7i-0005FQ-SS for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7g-0005lI-7M for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:34 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-MbAGSbzGPzG7EKCEP4E0gA-1; Fri, 18 Sep 2020 12:20:26 -0400 Received: by mail-wr1-f72.google.com with SMTP id h4so2331205wrb.4 for ; Fri, 18 Sep 2020 09:20:26 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id f6sm6142752wro.5.2020.09.18.09.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cQLHX1DoJKJj5W3DVopK1pVavkbFhdLI78v3G2Q4YW4=; b=AG363yWk6/nA7gHEOKwnxL6COvMa2KcucqDfpgVp2QBiq2WLMzyJsf1qKsqT42Qi+fNFS8 BIW2NATISeNWupryZGiuUIL0yeUHT82dPBIY/KBEvE2UsddvF5XReoLSYBWMZ7Dw+8kbfm Sd/PQOial2+f7hCAihfCKGRv8Z/IEUI= X-MC-Unique: MbAGSbzGPzG7EKCEP4E0gA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cQLHX1DoJKJj5W3DVopK1pVavkbFhdLI78v3G2Q4YW4=; b=FJpS7GPBHpzgxXHAK93b6HJs3bHhGSiZQ5N7xKfOadO4XL5zpfKrZT2RGqpb+hlnwD 4II/oSCKxcKgoQqt8fcq0W76cmmAJGTfozV0YnsFe5GwWI391E5L6rELZMeo3rH7O3zV EnyF+ynjKE3fLk5Ed5d98vqkTfdWox4qVbmXoHhUnuyXivOGTzymH0qgppWgudmpWotf zSNSH006sdsgAtdUHAJFJUmOSxSGn41NaJxdJ2cY/pAj4CQath7v6rjaH+3HoKGi6Rdh 6v0EldVjF+/DgK5n1vO3FhKPoP7npMapKhOYt4/gY9GpuWDcpaRkiPq8F/0F/A4VeNdu znHw== X-Gm-Message-State: AOAM532AH9Y5aDb5v8yE5ouVyMdvOabR5hxe3Eg8vcsUAbcP4jOH2hPE WcVdDB9zPtbm6OaPRnIJUZ+2e1RYWlZtpcH72Qx2iARpseOOAgZTQ482uT7ZBrzJj+0myj3DvhY wFN8XSeWqyG5D5wg= X-Received: by 2002:a5d:43cf:: with SMTP id v15mr39531344wrr.269.1600446025041; Fri, 18 Sep 2020 09:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbkL3nYp1jsxgLayp4DGAN/gpY7D4KM3CDnNmJ+cr4f+xKKfaogLgWL2DJp3EZFfDPdt+htA== X-Received: by 2002:a5d:43cf:: with SMTP id v15mr39531317wrr.269.1600446024822; Fri, 18 Sep 2020 09:20:24 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:22 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 09/15] tests/qtest/libqos/virtio-blk: add support for vhost-user-blk Message-ID: <20200918161836.318893-10-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Raphael Norwitz , Paolo Bonzini , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov Add support for the vhost-user-blk-pci device. This node can be used by the vhost-user-blk tests. Tests for the vhost-user-blk device are added in the following patches. Signed-off-by: Dima Stepanov Message-Id: <4d3e683a87557bcef520826c54aa3e5ab7c64111.1599813294.git.dimast= ep@yandex-team.ru> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/libqos/virtio-blk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqos/virtio-blk.c b/tests/qtest/libqos/virtio-bl= k.c index 5da02591bc..c0fd9d24e3 100644 --- a/tests/qtest/libqos/virtio-blk.c +++ b/tests/qtest/libqos/virtio-blk.c @@ -30,7 +30,8 @@ static void *qvirtio_blk_get_driver(QVirtioBlk *v_blk, const char *interface) { - if (!g_strcmp0(interface, "virtio-blk")) { + if (!g_strcmp0(interface, "virtio-blk") || + !g_strcmp0(interface, "vhost-user-blk")) { return v_blk; } if (!g_strcmp0(interface, "virtio")) { @@ -120,6 +121,17 @@ static void virtio_blk_register_nodes(void) qos_node_produces("virtio-blk-pci", "virtio-blk"); =20 g_free(arg); + + /* vhost-user-blk-pci */ + arg =3D g_strdup_printf("id=3Ddrv0,chardev=3Dchdev0,addr=3D%x.%x", + PCI_SLOT, PCI_FN); + opts.extra_device_opts =3D arg; + add_qpci_address(&opts, &addr); + qos_node_create_driver("vhost-user-blk-pci", virtio_blk_pci_create); + qos_node_consumes("vhost-user-blk-pci", "pci-bus", &opts); + qos_node_produces("vhost-user-blk-pci", "vhost-user-blk"); + + g_free(arg); } =20 libqos_init(virtio_blk_register_nodes); --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447991; cv=none; d=zohomail.com; s=zohoarc; b=ZH7HqVNxlAkCFIrQobwso1N9cDKfj2qFK0ybi8a0zvf5veYVrb5yPhS94TkDQB5ZIEc4Tel4+DRugBGXikniFYVpcFCUAD8atJEm7/WrPEjkR91LKFrQUNGPkX253umj/Ihr3DQrt/eCkPPn/UpQGXSNgY0lSdDpeCaBfHnjeLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447991; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lDSZLJWx726orNL/pq3HYQeEZa9xRbLWzSxUCmTjU8o=; b=lQwrcUXKQTOr8zZeBLHsy8pXB1U14uFAlDo495aIxm5JzN/UiK3rkxYSoU+nm97SOhvCmmBlBXCSq7iDk3KXTxuUaeUunRXi53OeUPtb8bhgquEO+fMJ9EpqNZ2kcnrpAsoSkvutM+Xy+gYOeX4tbooouKY61SAlQmeHQlYw2vA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447991913582.1381464690279; Fri, 18 Sep 2020 09:53:11 -0700 (PDT) Received: from localhost ([::1]:58342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJdC-0000Be-QV for importer@patchew.org; Fri, 18 Sep 2020 12:53:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7s-0005ID-1b for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7i-0005lQ-LC for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:38 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-fNZae6lbPoqzhDGlF6Xg0Q-1; Fri, 18 Sep 2020 12:20:29 -0400 Received: by mail-wm1-f69.google.com with SMTP id m19so481385wmg.6 for ; Fri, 18 Sep 2020 09:20:29 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id s80sm5675716wme.41.2020.09.18.09.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lDSZLJWx726orNL/pq3HYQeEZa9xRbLWzSxUCmTjU8o=; b=foJnwsYBp4fgdNFNrLfrjZnOtfd0kAD9pMZlWm9pqOlr5z2LumNaJ8EXIG/0DcF0vYrsuE 3Lab7WH883v/tNIgFoi1yfp709mgOS6mbSO3xDltasEJiEti6KdWONBnTE0PTHUNNY7mPE jpMqFKe/1SI5IhrMu7G+F+R7oKwH38A= X-MC-Unique: fNZae6lbPoqzhDGlF6Xg0Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lDSZLJWx726orNL/pq3HYQeEZa9xRbLWzSxUCmTjU8o=; b=HYIAtTq+KDv92AvJThdGdRejzDTTnO/bQjPEoAin1o+pLbm7b0qiJNDVC4xb+yc8gu Yixo5ywospfmrYNyEAcbDp/6whI/0Dj0v/aw1LF4U8Ok9YS5iaD7OpqLHNqSHnw59GDD uXBTbLRlPC1uya4IRqpJxtZ9QDYfyIbIE/31m+VmLJtykwyuELBzVGCD+E8V9ePbJ8Je Xsb1opVidIvMwZEP8J5z24tOdF1l91R/P3KpTp81uIhBYUKIRF+bv5t9h2fLtXn8XR3a aFLSv5bXQAu2RVVeii4YshgKduEt699Xw97EdcyFPiVZDAedH3dQEnmzXovpLb9dZ2Eg Tj7w== X-Gm-Message-State: AOAM533MPk/hqNQWakcZeHzGjV5IADD1FzOR/caFBE9MfGPOJi0gSK9s r87G/ztc1xgA/6odc9dShwgsiaZHgKp9w6SvR5XpW5wcen0TPcStdLvD1CVO6QOfOu+x+H3zday w/QDv8iaurkLxUEg= X-Received: by 2002:a1c:4d12:: with SMTP id o18mr17477405wmh.177.1600446028026; Fri, 18 Sep 2020 09:20:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPVg2QxhN9WcAFA/aaDmP7RLGMiwaLzpvYus0Cp1PkMhHjwcYrxMXymS5IGzkUJmrWsQ3n2Q== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr17477386wmh.177.1600446027786; Fri, 18 Sep 2020 09:20:27 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:25 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 10/15] tests/qtest/vhost-user-test: add support for the vhost-user-blk device Message-ID: <20200918161836.318893-11-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Raphael Norwitz , Paolo Bonzini , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov Add vhost_user_ops structure for the vhost-user-blk device class. Add the test_reconnect and test_migrate tests for this device. Signed-off-by: Dima Stepanov Reviewed-by: Raphael Norwitz Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 139 +++++++++++++++++++++++++++++++++- 1 file changed, 137 insertions(+), 2 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 3df5322614..a8af6134e5 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -24,6 +24,7 @@ #include "libqos/libqos.h" #include "libqos/pci-pc.h" #include "libqos/virtio-pci.h" +#include "libqos/virtio-blk.h" =20 #include "libqos/malloc-pc.h" #include "hw/virtio/virtio-net.h" @@ -31,6 +32,7 @@ #include "standard-headers/linux/vhost_types.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_net.h" +#include "standard-headers/linux/virtio_blk.h" =20 #ifdef CONFIG_LINUX #include @@ -43,6 +45,7 @@ " -numa node,memdev=3Dmem" #define QEMU_CMD_CHR " -chardev socket,id=3D%s,path=3D%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=3Dhs0,chardev=3D%s,vhostfo= rce" +#define QEMU_CMD_BLKCHR " -chardev socket,id=3Dchdev0,path=3D%s%s" =20 #define HUGETLBFS_MAGIC 0x958458f6 =20 @@ -55,6 +58,7 @@ #define VHOST_USER_PROTOCOL_F_MQ 0 #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 +#define VHOST_USER_PROTOCOL_F_CONFIG 9 =20 #define VHOST_LOG_PAGE 0x1000 =20 @@ -78,6 +82,8 @@ typedef enum VhostUserRequest { VHOST_USER_SET_PROTOCOL_FEATURES =3D 16, VHOST_USER_GET_QUEUE_NUM =3D 17, VHOST_USER_SET_VRING_ENABLE =3D 18, + VHOST_USER_GET_CONFIG =3D 24, + VHOST_USER_SET_CONFIG =3D 25, VHOST_USER_MAX } VhostUserRequest; =20 @@ -99,6 +105,14 @@ typedef struct VhostUserLog { uint64_t mmap_offset; } VhostUserLog; =20 +#define VHOST_USER_MAX_CONFIG_SIZE 256 +typedef struct VhostUserConfig { + uint32_t offset; + uint32_t size; + uint32_t flags; + uint8_t region[VHOST_USER_MAX_CONFIG_SIZE]; +} VhostUserConfig; + typedef struct VhostUserMsg { VhostUserRequest request; =20 @@ -114,6 +128,7 @@ typedef struct VhostUserMsg { struct vhost_vring_addr addr; VhostUserMemory memory; VhostUserLog log; + VhostUserConfig config; } payload; } QEMU_PACKED VhostUserMsg; =20 @@ -137,6 +152,7 @@ enum { =20 enum { VHOST_USER_NET, + VHOST_USER_BLK, }; =20 typedef struct TestServer { @@ -166,12 +182,15 @@ struct vhost_user_ops { int type; void (*append_opts)(TestServer *s, GString *cmd_line, const char *chr_opts); + void (*driver_init)(void *obj, QGuestAllocator *alloc); =20 /* VHOST-USER commands. */ void (*set_features)(TestServer *s, CharBackend *chr, VhostUserMsg *msg); void (*get_protocol_features)(TestServer *s, CharBackend *chr, VhostUserMsg *msg); + void (*get_config)(TestServer *s, CharBackend *chr, + VhostUserMsg *msg); }; =20 static const char *init_hugepagefs(void); @@ -194,6 +213,14 @@ static void append_vhost_net_opts(TestServer *s, GStri= ng *cmd_line, chr_opts, s->chr_name); } =20 +static void append_vhost_blk_opts(TestServer *s, GString *cmd_line, + const char *chr_opts) +{ + g_string_append_printf(cmd_line, QEMU_CMD_BLKCHR, + s->socket_path, + chr_opts); +} + static void append_mem_opts(TestServer *server, GString *cmd_line, int size, enum test_memfd memfd) { @@ -425,6 +452,12 @@ static void chr_read(void *opaque, const uint8_t *buf,= int size) qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; =20 + case VHOST_USER_GET_CONFIG: + if (s->vu_ops->get_config) { + s->vu_ops->get_config(s, chr, &msg); + } + break; + default: break; } @@ -727,6 +760,9 @@ static void test_migrate(void *obj, void *arg, QGuestAl= locator *alloc) guint8 *log; guint64 size; =20 + if (s->vu_ops->driver_init) { + s->vu_ops->driver_init(obj, alloc); + } if (!wait_for_fds(s)) { return; } @@ -796,6 +832,24 @@ static void test_migrate(void *obj, void *arg, QGuestA= llocator *alloc) g_string_free(dest_cmdline, true); } =20 +static void vu_blk_driver_init(void *obj, QGuestAllocator *alloc) +{ + QVirtioBlk *blk_if; + QVirtioDevice *dev; + QVirtQueue *vq; + uint64_t features; + + blk_if =3D obj; + dev =3D blk_if->vdev; + features =3D qvirtio_get_features(dev); + qvirtio_set_features(dev, features); + + vq =3D qvirtqueue_setup(dev, alloc, 0); + g_assert(vq); + + qvirtio_set_driver_ok(dev); +} + static void wait_for_rings_started(TestServer *s, size_t count) { gint64 end_time; @@ -857,12 +911,21 @@ static void test_reconnect(void *obj, void *arg, QGue= stAllocator *alloc) { TestServer *s =3D arg; GSource *src; + int nq; =20 + if (s->vu_ops->driver_init) { + s->vu_ops->driver_init(obj, alloc); + } if (!wait_for_fds(s)) { return; } =20 - wait_for_rings_started(s, 2); + nq =3D 1; + if (s->vu_ops->type =3D=3D VHOST_USER_NET) { + /* tx and rx queues */ + nq =3D 2; + } + wait_for_rings_started(s, nq); =20 /* reconnect */ s->fds_num =3D 0; @@ -872,7 +935,7 @@ static void test_reconnect(void *obj, void *arg, QGuest= Allocator *alloc) g_source_attach(src, s->context); g_source_unref(src); g_assert(wait_for_fds(s)); - wait_for_rings_started(s, 2); + wait_for_rings_started(s, nq); } =20 static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *a= rg) @@ -960,6 +1023,56 @@ static void vu_net_get_protocol_features(TestServer *= s, CharBackend *chr, qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->= size); } =20 +static void vu_blk_set_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + if (s->test_flags =3D=3D TEST_FLAGS_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags =3D TEST_FLAGS_BAD; + } +} + +static void vu_blk_get_protocol_features(TestServer *s, + CharBackend *chr, VhostUserMsg *msg) +{ + /* send back features to qemu */ + msg->flags |=3D VHOST_USER_REPLY_MASK; + msg->size =3D sizeof(m.payload.u64); + msg->payload.u64 =3D 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg->payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_CONFIG; + if (s->queues > 1) { + msg->payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_MQ; + } + qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->= size); +} + +static void vu_blk_get_config(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + VhostUserConfig *config; + struct virtio_blk_config *blk_config; + + config =3D &msg->payload.config; + memset(config, 0, sizeof(*config)); + config->size =3D sizeof(*blk_config); + + blk_config =3D (struct virtio_blk_config *)&config->region; + /* + * Represent 128Mb test disk, with no real backend, just + * to test vhost-user functionality. + */ + blk_config->capacity =3D 262144; + blk_config->size_max =3D 0x20000; + blk_config->seg_max =3D 0x7e; + blk_config->blk_size =3D 512; + blk_config->min_io_size =3D 0x1; + blk_config->num_queues =3D 0x1; + + msg->size =3D sizeof(*config) - sizeof(config->region) + config->size; + msg->flags |=3D VHOST_USER_REPLY_MASK; + qemu_chr_fe_write_all(chr, (uint8_t *)msg, VHOST_USER_HDR_SIZE + msg->= size); +} + /* Each VHOST-USER device should have its ops structure defined. */ static struct vhost_user_ops g_vu_net_ops =3D { .type =3D VHOST_USER_NET, @@ -970,6 +1083,17 @@ static struct vhost_user_ops g_vu_net_ops =3D { .get_protocol_features =3D vu_net_get_protocol_features, }; =20 +static struct vhost_user_ops g_vu_blk_ops =3D { + .type =3D VHOST_USER_BLK, + + .append_opts =3D append_vhost_blk_opts, + .driver_init =3D vu_blk_driver_init, + + .set_features =3D vu_blk_set_features, + .get_protocol_features =3D vu_blk_get_protocol_features, + .get_config =3D vu_blk_get_config, +}; + static void register_vhost_user_test(void) { QOSGraphTestOptions opts =3D { @@ -1015,5 +1139,16 @@ static void register_vhost_user_test(void) qos_add_test("vhost-user/multiqueue", "virtio-net", test_multiqueue, &opts); + opts.edge.extra_device_opts =3D NULL; + + /* vhost-user-blk tests */ + opts.arg =3D &g_vu_blk_ops; + opts.before =3D vhost_user_test_setup_reconnect; + qos_add_test("reconnect", "vhost-user-blk", + test_reconnect, &opts); + + opts.before =3D vhost_user_test_setup_memfd; + qos_add_test("migrate", "vhost-user-blk", + test_migrate, &opts); } libqos_init(register_vhost_user_test); --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447225; cv=none; d=zohomail.com; s=zohoarc; b=AESNdl7AeZWHrew8X9Y/Tn85tt1x5CCVuoPPWJDzavq6HIdRggdKVa9SMe0yBB3Bu2onSq2yxknfgPDJr6LKS4rds5X7hfe3EpCyumcSL63QYlx5jF8rWKKsSaEAYKSNOwj2XCB6CC7m65HgNlrShmlWkp8FwIFo++6kqDCPAZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447225; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yhYJpQzkvGCIJw31OhiepZGEIbut9i/93SgdsUTymmI=; b=TnoiftOcg4fyx/uko/2mVXX3hC8+KI6+5DLcEsehFKwz2AhcB4x6l4HbFqhgD6ewP2NE2rJYE2znHemNKMPuOzJ+7O6/X/0ZCeID7gLXRM34H9bk2+iGZ1SmQw98UV3apaWIY0fBFfOqGfhOqkMybsaCTLFyyHSNZVHYgNMP+Pc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447225468236.5158541448409; Fri, 18 Sep 2020 09:40:25 -0700 (PDT) Received: from localhost ([::1]:60796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJQu-0005pp-5E for importer@patchew.org; Fri, 18 Sep 2020 12:40:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ84-0005Lj-BE for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7r-0005lY-J6 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:54 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-9XVASeqeOcmugn6asB5n5A-1; Fri, 18 Sep 2020 12:20:32 -0400 Received: by mail-wr1-f71.google.com with SMTP id f18so2312437wrv.19 for ; Fri, 18 Sep 2020 09:20:32 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id g14sm6471301wrv.25.2020.09.18.09.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yhYJpQzkvGCIJw31OhiepZGEIbut9i/93SgdsUTymmI=; b=ZWI4eam0w+U7GnfFapQwtdWynpUlKOuma6mYsIeID5qU16of/JbhLbHuLXwBUi1aPnyMlo gcSy9hYWpFHOEFvJxPwoBcfiHAByyEle25J2I/H1F1V60Kt3f+jOC6Vdb4Qzt0nLAZ35Gk YSXL1XnVLvjX7AMC5le2NXXaRJN/6/0= X-MC-Unique: 9XVASeqeOcmugn6asB5n5A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yhYJpQzkvGCIJw31OhiepZGEIbut9i/93SgdsUTymmI=; b=ODIwM5HFkvKj6xGrf3h+ubFn6MIJTpkqRXMDIVx15hGzpMbefbq4rXKNpiIOphzM76 6ZU9AEyVNy84ycFZ7lN7V/Gb5z3KAWC3QSyQvbVfp2zSHBXBW14KMd89Q1eeTVY+EzgJ YGgItPcv28S0D8tuuAVPD4UZO47ZlnYMWLvRmj23zZyBJ1TKYLbwcm+OIMAQbXmkI8DQ mMj2h0Qne0XUUVJegKJfaXXy4qgzXYpuL7nHcxzsIgbMTmhSpIuBMcPT+X7BtdkqSN6K WhecY2UxDvpEQKDcnZuVBaciudwcBUeBbfmqoP2SMgKRVCR6xYu1bQeH7X8WLWR1UTgd j83Q== X-Gm-Message-State: AOAM532yanPpgaUKQZay6ADbAEyavvJ2iGuA1grOxHgFrPBl+Mq6e7Th YGchIvtWGhZCeKjpCAyfCT1f137CAN6DimAtnhBX+rRLurqTz06fy6SRx1XOMTMAb6nl9qd+1o2 4ZqaDmEvw0DDcrCQ= X-Received: by 2002:a7b:c76d:: with SMTP id x13mr2403534wmk.10.1600446030911; Fri, 18 Sep 2020 09:20:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8K/a6NQ/rQ2eBRF9p9tNEmw+10DZnvLDnAMSu6HAxAYv6yW6sfQDoqAhwn6sKoMKzkLQlfA== X-Received: by 2002:a7b:c76d:: with SMTP id x13mr2403512wmk.10.1600446030673; Fri, 18 Sep 2020 09:20:30 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 11/15] tests/qtest/vhost-user-test: add migrate_reconnect test Message-ID: <20200918161836.318893-12-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 01:32:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Raphael Norwitz , Paolo Bonzini , Dima Stepanov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov Add new migrate_reconnect test for the vhost-user-blk device. Perform a disconnect after sending response for the VHOST_USER_SET_LOG_BASE command. Signed-off-by: Dima Stepanov Reviewed-by: Raphael Norwitz Message-Id: <6f38139d24a1be703a6f1c7d983faccdf21d2a9a.1599813294.git.dimast= ep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index a8af6134e5..4b715d385e 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -146,6 +146,7 @@ static VhostUserMsg m __attribute__ ((unused)); enum { TEST_FLAGS_OK, TEST_FLAGS_DISCONNECT, + TEST_FLAGS_MIGRATE_DISCONNECT, TEST_FLAGS_BAD, TEST_FLAGS_END, }; @@ -436,6 +437,15 @@ static void chr_read(void *opaque, const uint8_t *buf,= int size) qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE); =20 g_cond_broadcast(&s->data_cond); + /* + * Perform disconnect after sending a response. In this + * case the next write command on the QEMU side (for now + * it is SET_FEATURES will return -1, because of disconnect. + */ + if (s->test_flags =3D=3D TEST_FLAGS_MIGRATE_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags =3D TEST_FLAGS_BAD; + } break; =20 case VHOST_USER_SET_VRING_BASE: @@ -737,6 +747,17 @@ static void *vhost_user_test_setup_memfd(GString *cmd_= line, void *arg) return server; } =20 +static void *vhost_user_test_setup_migrate_reconnect(GString *cmd_line, + void *arg) +{ + TestServer *server; + + server =3D vhost_user_test_setup_memfd(cmd_line, arg); + server->test_flags =3D TEST_FLAGS_MIGRATE_DISCONNECT; + + return server; +} + static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *all= oc) { TestServer *server =3D arg; @@ -1150,5 +1171,9 @@ static void register_vhost_user_test(void) opts.before =3D vhost_user_test_setup_memfd; qos_add_test("migrate", "vhost-user-blk", test_migrate, &opts); + + opts.before =3D vhost_user_test_setup_migrate_reconnect; + qos_add_test("migrate_reconnect", "vhost-user-blk", + test_migrate, &opts); } libqos_init(register_vhost_user_test); --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600447435; cv=none; d=zohomail.com; s=zohoarc; b=kQ72FpTC8Vi4Z4pm4OvgX/+4hwFgOvTDSd3A2iCj2XrXLNq8CGIdTMrt66W4/vsy8WbQMT0dDL6eY3X+0rbjPCPHvR6gHHIE0jRIFJ3Taifi2oXZQpKfjUPBuv2PTDCuL9zEDYSTDAoDCuM/agnVJJTBxir5Az3Ne0L/bYUTwyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600447435; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i2TiZHENdC+GX0K3cObev7mdt5+URJTuRvO6etG6pyY=; b=IzRFlle7sAaa5X4CHYEEsAMJ1tBh/PtibdHkK//TgUzrEjztE/kl42/R2EkFEuHBplhYojKg638cYBgrMSm9E3ssV/pleK248kvjgE63EmM4P3UolA/5E3sZE/QPldEJ0ZrkcvygJYFLxnnyge8odoET0lAF6Juq0vH/7WM4/fE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600447434719472.76723778823646; Fri, 18 Sep 2020 09:43:54 -0700 (PDT) Received: from localhost ([::1]:41802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJUG-0001JR-Qd for importer@patchew.org; Fri, 18 Sep 2020 12:43:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ89-0005OG-Mi for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:27109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ83-0005m2-Ot for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:21:01 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-gLdt7khWNymnJM5iwNrzfQ-1; Fri, 18 Sep 2020 12:20:36 -0400 Received: by mail-wm1-f70.google.com with SMTP id y18so1625125wma.4 for ; Fri, 18 Sep 2020 09:20:35 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id m10sm5575903wmi.9.2020.09.18.09.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=i2TiZHENdC+GX0K3cObev7mdt5+URJTuRvO6etG6pyY=; b=ghaU170Uw6p+2d7e5dxs16eaAv2rBUIUEQzRDZsW8VMRssGTv44ET6+NXKnbYamaVdn1eS Vl/3MjZfcNea92Wrv8UQmQh0hHJ5RmakBRl25Eo4YBfTB/CHBM0g1AQ/beWPnad3tlZQe4 mCkka3J050HJC4goBaVIfXlvwlk2DfE= X-MC-Unique: gLdt7khWNymnJM5iwNrzfQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=i2TiZHENdC+GX0K3cObev7mdt5+URJTuRvO6etG6pyY=; b=n+a2mtOF7cSeRX/CReSvdrCZsasPp2D6NIDW4i327IWmnKQ1cpoa96KqVRQgz9kv2M pit7uc2k2ILTBNwTui6STinDT7tFsTT9ieypGJZbCJuKcrknD4VOPVk7jURNJtp0Es6j U7MXgxzp4eo77yxyokvQz0gSOQXZ3/SSNnacgLtcDfbh32sPkg0ba7aDifyp1I5LktE/ oleFjwUXWg938iIgUdDx2cCCQLfwkolJgvy4qa+iaA74behrMLp8T6MLkg07u4G4EIn+ /qZ3mSBCVWpgOFZDgn+1Y/CuknyRZ9yVOwiaLn4BJ83D1usZtKUF57iX2A3aJLjp5Auz sVkQ== X-Gm-Message-State: AOAM532SsyhL8ea9Op+B9/HBBMtuzTa1leWmeQiFNilZ9ZVUDmxgJRFF k28WcMs47K0VHp4vTK+yC5g7pj5yhCZT1g/FYqH+c4Nbv9gA0XnZe3U00F6qj2oNZSssnfe9orJ FERzeDVpU6KB3Lx0= X-Received: by 2002:adf:f082:: with SMTP id n2mr38107375wro.35.1600446033579; Fri, 18 Sep 2020 09:20:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydDGfWgXaZOGcplo5mq0ekzKO+rpCtFqJJhffC1f+xqP7yF7KGkDUHJ88vT3inQBcAnbWZBg== X-Received: by 2002:adf:f082:: with SMTP id n2mr38107357wro.35.1600446033426; Fri, 18 Sep 2020 09:20:33 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 12/15] tests/qtest/vhost-user-test: enable the reconnect tests Message-ID: <20200918161836.318893-13-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Dima Stepanov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dima Stepanov For now a QTEST_VHOST_USER_FIXME environment variable is used to separate reconnect tests for the vhost-user-net device. Looks like the reconnect functionality is pretty stable, so this separation is deprecated. Remove it and enable these tests for the default run. Signed-off-by: Dima Stepanov Message-Id: <9fee5b17c7940f9126ba7cc014b09106c98118db.1599813294.git.dimast= ep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 4b715d385e..4b9631249d 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -1140,20 +1140,17 @@ static void register_vhost_user_test(void) "virtio-net", test_migrate, &opts); =20 - /* keeps failing on build-system since Aug 15 2017 */ - if (getenv("QTEST_VHOST_USER_FIXME")) { - opts.before =3D vhost_user_test_setup_reconnect; - qos_add_test("vhost-user/reconnect", "virtio-net", - test_reconnect, &opts); + opts.before =3D vhost_user_test_setup_reconnect; + qos_add_test("vhost-user/reconnect", "virtio-net", + test_reconnect, &opts); =20 - opts.before =3D vhost_user_test_setup_connect_fail; - qos_add_test("vhost-user/connect-fail", "virtio-net", - test_vhost_user_started, &opts); + opts.before =3D vhost_user_test_setup_connect_fail; + qos_add_test("vhost-user/connect-fail", "virtio-net", + test_vhost_user_started, &opts); =20 - opts.before =3D vhost_user_test_setup_flags_mismatch; - qos_add_test("vhost-user/flags-mismatch", "virtio-net", - test_vhost_user_started, &opts); - } + opts.before =3D vhost_user_test_setup_flags_mismatch; + qos_add_test("vhost-user/flags-mismatch", "virtio-net", + test_vhost_user_started, &opts); =20 opts.before =3D vhost_user_test_setup_multiqueue; opts.edge.extra_device_opts =3D "mq=3Don"; --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600446176; cv=none; d=zohomail.com; s=zohoarc; b=iAEMeubjzjIbnxs2gvoMAal09PG5mJapVbn75CUQhq9XAGK7iIY8xk9q5Ock4ZxVoYVg3O/HfSdbKq+OZzxGoBUpA2P+oynN+kHoWt6PY8PLKfNjbUgP9Hl1OEn6Z62ro06z7ntQ5xu7bh7ou+dBqJNdsZiESokULvB15ijzq98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600446176; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p+UkMbHw7A0wZD6E1HsNyZ5qPFAY5u5AZjBJxMTg5x8=; b=dbcpo46R0pPAgavt1AEos3sS3PfW9NZ7fdW9Za9tF8X9ZBeaLH7W5S5TcL+AQ6/eXaf/qK5vdeqH+Jl01XDXoj3vwMlXSNbGNT9OJ0fkeTsLdqSUu2Ow3X2I4z/PBmxvfNHUPN3BtEQieqsgcANEWkfvk8smKSpIkQIrHsx8668= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1600446176796399.4337290461119; Fri, 18 Sep 2020 09:22:56 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-Qp5IYC01MSeQ79TGsKHEuQ-1; Fri, 18 Sep 2020 12:22:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 107AC8030A9; Fri, 18 Sep 2020 16:22:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCB219CBA; Fri, 18 Sep 2020 16:22:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4EECD183D043; Fri, 18 Sep 2020 16:22:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08IGKiO5015102 for ; Fri, 18 Sep 2020 12:20:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49CC82028CCE; Fri, 18 Sep 2020 16:20:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43F7F2017E9B for ; Fri, 18 Sep 2020 16:20:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2EBB900C62 for ; Fri, 18 Sep 2020 16:20:40 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-21cDqv_SPMKAhG1PJOr8ow-1; Fri, 18 Sep 2020 12:20:38 -0400 Received: by mail-wr1-f69.google.com with SMTP id x15so2300854wrm.7 for ; Fri, 18 Sep 2020 09:20:38 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id w15sm5762185wro.46.2020.09.18.09.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446175; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=p+UkMbHw7A0wZD6E1HsNyZ5qPFAY5u5AZjBJxMTg5x8=; b=K8hfAAiWAsI9pBoiqAvBfNr0hkGdwnN3EIfgFFC6cDaOM+ETcBKfVbV4w0DJUiATr/lqaq XXOy1gkQS96ZjouvJABdt14xG15/Qytf3MYbyK8A1eqBYtAucW065HftKb9rN39VF5s9km 4jrlbvGHIToC+O/NGCB6R2jhphRe5SI= X-MC-Unique: Qp5IYC01MSeQ79TGsKHEuQ-1 X-MC-Unique: 21cDqv_SPMKAhG1PJOr8ow-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=p+UkMbHw7A0wZD6E1HsNyZ5qPFAY5u5AZjBJxMTg5x8=; b=MP8U99iVfbnSdRyrV5QWayD503NXOVb23rpXTi2etJruy4PBziujCBhypkQ4EpydFK kZ6xn3k9bq5Fc++3hRoTlfF16Vh4wmObJHbJFuuEjS0Hf0dpKepxYI2ul/MnxWzwtxbM rWD786YY7nOreB7z+EPyAUOSZuICErgeUybTbz/qLz5FBxOBlpweQ//EEFHvp60S24/d +hgAggGInykr+yW3JGBAPMrUhNUfqOLYoT8hZotpAi7Mx+kJcaTf06zOO8wMD6SqnOMk ofKMNWNCma7gNHysoesNKhwW8Hdv1j6hYJ7jXs/NdZzCcVAEWxgPNAUZcxDSMsKTkKoS ZbfA== X-Gm-Message-State: AOAM533A0U4q7dRJDEr6J44MRTqYYyP+dRAfZVlX5VF5332SoiF5WDUM GkdtTM8B42O65nCHvDe35tmHOvoRWrnEWSRNVrUbKCe9nblYtBqQxLTAX1Mp01G6WlSeNuIbfTB +2IMpOPB49Xo3yqhs0RY= X-Received: by 2002:a1c:6484:: with SMTP id y126mr16404491wmb.177.1600446037302; Fri, 18 Sep 2020 09:20:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6vETPVqcMnNGa9gRcSWO05TxdeOCu2ZUe6kkuubA9pt3ZZFFFH5VFfUsGlw4pl3Mljkd5bQ== X-Received: by 2002:a1c:6484:: with SMTP id y126mr16404461wmb.177.1600446036979; Fri, 18 Sep 2020 09:20:36 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 13/15] cphp: remove deprecated cpu-add command(s) Message-ID: <20200918161836.318893-14-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eduardo Habkost , David Hildenbrand , libvir-list@redhat.com, Michal Privoznik , Cornelia Huck , "Dr . David Alan Gilbert" , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Marcel Apfelbaum , Paolo Bonzini , Igor Mammedov , Richard Henderson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov These were deprecated since 4.0, remove both HMP and QMP variants. Users should use device_add command instead. To get list of possible CPUs and options, use 'info hotpluggable-cpus' HMP or query-hotpluggable-cpus QMP command. Signed-off-by: Igor Mammedov Reviewed-by: Thomas Huth Acked-by: Dr. David Alan Gilbert Reviewed-by: Michal Privoznik Acked-by: Cornelia Huck Message-Id: <20200915120403.1074579-1-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/machine.json | 24 --------- include/hw/boards.h | 1 - include/hw/i386/pc.h | 1 - include/monitor/hmp.h | 1 - hw/core/machine-hmp-cmds.c | 12 ----- hw/core/machine-qmp-cmds.c | 12 ----- hw/i386/pc.c | 27 ---------- hw/i386/pc_piix.c | 1 - hw/s390x/s390-virtio-ccw.c | 12 ----- tests/qtest/cpu-plug-test.c | 100 ++++-------------------------------- tests/qtest/test-hmp.c | 1 - docs/system/deprecated.rst | 25 +++++---- hmp-commands.hx | 15 ------ 13 files changed, 21 insertions(+), 211 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 0ac1880e4a..d8ed096e9a 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -307,30 +307,6 @@ ## { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } =20 -## -# @cpu-add: -# -# Adds CPU with specified ID. -# -# @id: ID of CPU to be created, valid values [0..max_cpus) -# -# Features: -# @deprecated: This command is deprecated. Use `device_add` instead. -# See the `query-hotpluggable-cpus` command for details. -# -# Returns: Nothing on success -# -# Since: 1.5 -# -# Example: -# -# -> { "execute": "cpu-add", "arguments": { "id": 2 } } -# <- { "return": {} } -# -## -{ 'command': 'cpu-add', 'data': {'id': 'int'}, - 'features': [ 'deprecated' ] } - ## # @MachineInfo: # diff --git a/include/hw/boards.h b/include/hw/boards.h index 795910d01b..7abd5d889c 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -169,7 +169,6 @@ struct MachineClass { void (*init)(MachineState *state); void (*reset)(MachineState *state); void (*wakeup)(MachineState *state); - void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **err= p); int (*kvm_type)(MachineState *machine, const char *arg); void (*smp_parse)(MachineState *ms, QemuOpts *opts); =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c14e14dfe0..be42fe3599 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -134,7 +134,6 @@ extern int fd_bootchk; =20 void pc_acpi_smi_interrupt(void *opaque, int irq, int level); =20 -void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp); void pc_smp_parse(MachineState *ms, QemuOpts *opts); =20 void pc_guest_info_init(PCMachineState *pcms); diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index c986cfd28b..642e9e91f9 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -89,7 +89,6 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict); void hmp_chardev_change(Monitor *mon, const QDict *qdict); void hmp_chardev_remove(Monitor *mon, const QDict *qdict); void hmp_chardev_send_break(Monitor *mon, const QDict *qdict); -void hmp_cpu_add(Monitor *mon, const QDict *qdict); void hmp_object_add(Monitor *mon, const QDict *qdict); void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 39999c47c5..f4092b98cc 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -46,18 +46,6 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) qapi_free_CpuInfoFastList(cpu_list); } =20 -void hmp_cpu_add(Monitor *mon, const QDict *qdict) -{ - int cpuid; - Error *err =3D NULL; - - error_report("cpu_add is deprecated, please use device_add instead"); - - cpuid =3D qdict_get_int(qdict, "id"); - qmp_cpu_add(cpuid, &err); - hmp_handle_error(mon, err); -} - void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 21551221ad..5362c80a18 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -284,18 +284,6 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error= **errp) return machine_query_hotpluggable_cpus(ms); } =20 -void qmp_cpu_add(int64_t id, Error **errp) -{ - MachineClass *mc; - - mc =3D MACHINE_GET_CLASS(current_machine); - if (mc->hot_add_cpu) { - mc->hot_add_cpu(current_machine, id, errp); - } else { - error_setg(errp, "Not supported"); - } -} - void qmp_set_numa_node(NumaOptions *cmd, Error **errp) { if (!runstate_check(RUN_STATE_PRECONFIG)) { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b55369357e..5e1911fba0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -777,32 +777,6 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts) } } =20 -void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp) -{ - X86MachineState *x86ms =3D X86_MACHINE(ms); - int64_t apic_id =3D x86_cpu_apic_id_from_index(x86ms, id); - Error *local_err =3D NULL; - - if (id < 0) { - error_setg(errp, "Invalid CPU id: %" PRIi64, id); - return; - } - - if (apic_id >=3D ACPI_CPU_HOTPLUG_ID_LIMIT) { - error_setg(errp, "Unable to add CPU: %" PRIi64 - ", resulting APIC ID (%" PRIi64 ") is too large", - id, apic_id); - return; - } - - - x86_cpu_new(X86_MACHINE(ms), apic_id, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } -} - static void pc_machine_done(Notifier *notifier, void *data) { @@ -1699,7 +1673,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) mc->auto_enable_numa_with_memdev =3D true; mc->has_hotpluggable_cpus =3D true; mc->default_boot_order =3D "cad"; - mc->hot_add_cpu =3D pc_hot_add_cpu; mc->smp_parse =3D pc_smp_parse; mc->block_default_type =3D IF_IDE; mc->max_cpus =3D 255; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6f3e78bb60..2d8413a0ce 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -752,7 +752,6 @@ static void pc_i440fx_1_4_machine_options(MachineClass = *m) { pc_i440fx_1_5_machine_options(m); m->hw_version =3D "1.4.0"; - m->hot_add_cpu =3D NULL; compat_props_add(m->compat_props, pc_compat_1_4, pc_compat_1_4_len); } =20 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 3106bbea33..28266a3a35 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -553,17 +553,6 @@ static HotplugHandler *s390_get_hotplug_handler(Machin= eState *machine, return NULL; } =20 -static void s390_hot_add_cpu(MachineState *machine, - const int64_t id, Error **errp) -{ - ObjectClass *oc; - - g_assert(machine->possible_cpus->cpus[0].cpu); - oc =3D OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu)= ); - - s390x_new_cpu(object_class_get_name(oc), id, errp); -} - static void s390_nmi(NMIState *n, int cpu_index, Error **errp) { CPUState *cs =3D qemu_get_cpu(cpu_index); @@ -604,7 +593,6 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) s390mc->hpage_1m_allowed =3D true; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; - mc->hot_add_cpu =3D s390_hot_add_cpu; mc->block_default_type =3D IF_VIRTIO; mc->no_cdrom =3D 1; mc->no_floppy =3D 1; diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index e8ffbbce4b..a1c689414b 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -25,54 +25,6 @@ struct PlugTestData { }; typedef struct PlugTestData PlugTestData; =20 -static void test_plug_with_cpu_add(gconstpointer data) -{ - const PlugTestData *s =3D data; - char *args; - QDict *response; - unsigned int i; - - args =3D g_strdup_printf("-machine %s -cpu %s " - "-smp 1,sockets=3D%u,cores=3D%u,threads=3D%u,ma= xcpus=3D%u", - s->machine, s->cpu_model, - s->sockets, s->cores, s->threads, s->maxcpus); - qtest_start(args); - - for (i =3D 1; i < s->maxcpus; i++) { - response =3D qmp("{ 'execute': 'cpu-add'," - " 'arguments': { 'id': %d } }", i); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - } - - qtest_end(); - g_free(args); -} - -static void test_plug_without_cpu_add(gconstpointer data) -{ - const PlugTestData *s =3D data; - char *args; - QDict *response; - - args =3D g_strdup_printf("-machine %s -cpu %s " - "-smp 1,sockets=3D%u,cores=3D%u,threads=3D%u,ma= xcpus=3D%u", - s->machine, s->cpu_model, - s->sockets, s->cores, s->threads, s->maxcpus); - qtest_start(args); - - response =3D qmp("{ 'execute': 'cpu-add'," - " 'arguments': { 'id': %d } }", - s->sockets * s->cores * s->threads); - g_assert(response); - g_assert(qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_end(); - g_free(args); -} - static void test_plug_with_device_add(gconstpointer data) { const PlugTestData *td =3D data; @@ -144,36 +96,13 @@ static void add_pc_test_case(const char *mname) data->cores =3D 3; data->threads =3D 2; data->maxcpus =3D data->sockets * data->cores * data->threads; - if (g_str_has_suffix(mname, "-1.4") || - (strcmp(mname, "pc-1.3") =3D=3D 0) || - (strcmp(mname, "pc-1.2") =3D=3D 0) || - (strcmp(mname, "pc-1.1") =3D=3D 0) || - (strcmp(mname, "pc-1.0") =3D=3D 0)) { - path =3D g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=3D%u", - mname, data->sockets, data->cores, - data->threads, data->maxcpus); - qtest_add_data_func_full(path, data, test_plug_without_cpu_add, - test_data_free); - g_free(path); - } else { - PlugTestData *data2 =3D g_memdup(data, sizeof(PlugTestData)); =20 - data2->machine =3D g_strdup(data->machine); - data2->device_model =3D g_strdup(data->device_model); - - path =3D g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=3D%= u", - mname, data->sockets, data->cores, - data->threads, data->maxcpus); - qtest_add_data_func_full(path, data, test_plug_with_cpu_add, - test_data_free); - g_free(path); - path =3D g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus= =3D%u", - mname, data2->sockets, data2->cores, - data2->threads, data2->maxcpus); - qtest_add_data_func_full(path, data2, test_plug_with_device_add, - test_data_free); - g_free(path); - } + path =3D g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=3D%u= ", + mname, data->sockets, data->cores, + data->threads, data->maxcpus); + qtest_add_data_func_full(path, data, test_plug_with_device_add, + test_data_free); + g_free(path); } =20 static void add_pseries_test_case(const char *mname) @@ -205,7 +134,7 @@ static void add_pseries_test_case(const char *mname) static void add_s390x_test_case(const char *mname) { char *path; - PlugTestData *data, *data2; + PlugTestData *data; =20 if (!g_str_has_prefix(mname, "s390-ccw-virtio-")) { return; @@ -220,21 +149,10 @@ static void add_s390x_test_case(const char *mname) data->threads =3D 1; data->maxcpus =3D data->sockets * data->cores * data->threads; =20 - data2 =3D g_memdup(data, sizeof(PlugTestData)); - data2->machine =3D g_strdup(data->machine); - data2->device_model =3D g_strdup(data->device_model); - - path =3D g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=3D%u", + path =3D g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=3D%u= ", mname, data->sockets, data->cores, data->threads, data->maxcpus); - qtest_add_data_func_full(path, data, test_plug_with_cpu_add, - test_data_free); - g_free(path); - - path =3D g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=3D%u= ", - mname, data2->sockets, data2->cores, - data2->threads, data2->maxcpus); - qtest_add_data_func_full(path, data2, test_plug_with_device_add, + qtest_add_data_func_full(path, data, test_plug_with_device_add, test_data_free); g_free(path); } diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index aea1384bac..94a8023173 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -27,7 +27,6 @@ static const char *hmp_cmds[] =3D { "chardev-change testchardev1 ringbuf", "chardev-remove testchardev1", "commit all", - "cpu-add 1", "cpu 0", "device_add ?", "device_add usb-mouse,id=3Dmouse1", diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 0cb8b01424..cc31d79177 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -284,13 +284,6 @@ The ``query-cpus`` command is replaced by the ``query-= cpus-fast`` command. The ``arch`` output member of the ``query-cpus-fast`` command is replaced by the ``target`` output member. =20 -``cpu-add`` (since 4.0) -''''''''''''''''''''''' - -Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See -documentation of ``query-hotpluggable-cpus`` for additional -details. - ``query-events`` (since 4.0) '''''''''''''''''''''''''''' =20 @@ -306,12 +299,6 @@ the 'wait' field, which is only applicable to sockets = in server mode Human Monitor Protocol (HMP) commands ------------------------------------- =20 -``cpu-add`` (since 4.0) -''''''''''''''''''''''' - -Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See -documentation of ``query-hotpluggable-cpus`` for additional details. - ``acl_show``, ``acl_reset``, ``acl_policy``, ``acl_add``, ``acl_remove`` (= since 4.0.0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''''''''''' =20 @@ -529,6 +516,12 @@ QEMU Machine Protocol (QMP) commands The "autoload" parameter has been ignored since 2.12.0. All bitmaps are automatically loaded from qcow2 images. =20 +``cpu-add`` (removed in 5.2) +'''''''''''''''''''''''''''' + +Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See +documentation of ``query-hotpluggable-cpus`` for additional details. + Human Monitor Protocol (HMP) commands ------------------------------------- =20 @@ -538,6 +531,12 @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfw= d_remove`` (removed in 5.0 The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and 'hostfwd_remove' HMP commands has been replaced by ``netdev_id``. =20 +``cpu-add`` (removed in 5.2) +'''''''''''''''''''''''''''' + +Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``. See +documentation of ``query-hotpluggable-cpus`` for additional details. + Guest Emulator ISAs ------------------- =20 diff --git a/hmp-commands.hx b/hmp-commands.hx index 60f395c276..d1e3e0e1c6 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1761,21 +1761,6 @@ SRST Executes a qemu-io command on the given block device. ERST =20 - { - .name =3D "cpu-add", - .args_type =3D "id:i", - .params =3D "id", - .help =3D "add cpu (deprecated, use device_add instead)", - .cmd =3D hmp_cpu_add, - }, - -SRST -``cpu-add`` *id* - Add CPU with id *id*. This command is deprecated, please - +use ``device_add`` instead. For details, refer to - 'docs/cpu-hotplug.rst'. -ERST - { .name =3D "qom-list", .args_type =3D "path:s?", --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600448285; cv=none; d=zohomail.com; s=zohoarc; b=LVMqxOPvPAr//gFzS+r2y9BKsK3DhMKrK5ljw3iDjZ5HBWCGKxa3BHnn8YL9EPPeGHap2kHcpqL0yxyMZFtXqcDKoIgXRHpLpMi0lAGEqir2+Zd29cRTnS1YDUx7U/g3HYKm6msL/PREwT4nLH6OkzRsh7mJiRJwd8MHXXrL9vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600448285; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IiK5qvCobeUOC+twrCHu2MpA9Z7XZegxxrbNBvwmzOg=; b=fKWG+rRBu6BGhCBVoi1cnIYcDo3IRAICk4ln+WF4T3UIifftumhFkEC+tdQoACS/uE0CR1yE+w1jO8bVArH83qjSkWx881OCljIii4JBcR9zSYzYiaZoQwWT84BasH+WJEWhOq1HQYUMVQXssqR16RTmjbZmF76enAED0MClOUQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600448285678951.0432259033867; Fri, 18 Sep 2020 09:58:05 -0700 (PDT) Received: from localhost ([::1]:41248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJi0-0005Vx-Au for importer@patchew.org; Fri, 18 Sep 2020 12:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ87-0005MV-Ap for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42088) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ7w-0005mP-JM for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:59 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-K2mp6DgPOFKT4MKj2RL36A-1; Fri, 18 Sep 2020 12:20:41 -0400 Received: by mail-wr1-f71.google.com with SMTP id w7so2331726wrp.2 for ; Fri, 18 Sep 2020 09:20:41 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id a15sm6708269wrn.3.2020.09.18.09.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IiK5qvCobeUOC+twrCHu2MpA9Z7XZegxxrbNBvwmzOg=; b=SOBerWl/Euekoryv41/GF9EZ57qyfDaZfHBeH5y+12WWMhLzXfTQYmhLynQCPz4dv7F7MJ OoKx9fkNz7l3opi2VCTyEoksR8kgA3cE/jG+j5voQrDgZ73q1hlkyVKuJIx1WQDzevEYUY pvaRI2p/YTHAFlr5QPXwNxAgNdb4afA= X-MC-Unique: K2mp6DgPOFKT4MKj2RL36A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IiK5qvCobeUOC+twrCHu2MpA9Z7XZegxxrbNBvwmzOg=; b=G2X+dYsDjfMsyu2fcMpCpgcbwBLFyXjMhxX3OJwrfd33gQWO1NdjS/cyJ9A/rH7Vmr 8A3qboV6n5HcqjDAJxUQzfSuTopXmlIoKTztVdedUVA/QiyZbCvzipPTi3vKoKv4f6iM m7dF16jmibNL/ZdHkUPidbUHlxnuHJPfhxx9qQRUcgIG+drEmFHuJEl1YxARsrm3Hz5Y KIh6HuXPN3lJ66H940fo1vX7Oxd+OWd7OHcLM+9en+K6w58p8kZ0kqj5NHe0Z1GyKyNI viOpXVApxA3JGcNUdTGjYXmPXoKugvktMpZJIQYGEpw27KFDYvgkcqUrgEMo4c+PCeWX +fvA== X-Gm-Message-State: AOAM531FD5drVcualYO7SeTxSDlRRvGQz18QxH+6x+G8vvtCsiuBob4e ch7D6Tm8PP4LhkQOsH6hSSsrszi49rjkvQgaU+U22g8N0IhsK7qskrp8r2bivwCYw5hZX9rEr7+ FUGS+8bdghQdchH8= X-Received: by 2002:a5d:660f:: with SMTP id n15mr41548741wru.103.1600446039782; Fri, 18 Sep 2020 09:20:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU8gMy+Bu9s6kVYjRS5fbFgzkIWh34UnlkBXH8oSUpBcAtp3jG7Uy6+Phjc2vMDgrewFH6MA== X-Received: by 2002:a5d:660f:: with SMTP id n15mr41548719wru.103.1600446039571; Fri, 18 Sep 2020 09:20:39 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 14/15] virtio-iommu: Check gtrees are non null before destroying them Message-ID: <20200918161836.318893-15-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , qemu-stable@nongnu.org, Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger If realize fails, domains and endpoints trees may be NULL. On unrealize(), this produces assertions: "GLib: g_tree_destroy: assertion 'tree !=3D NULL' failed" Check that the trees are non NULL before destroying them. Cc: qemu-stable@nongnu.org Signed-off-by: Eric Auger Reviewed-by: Cornelia Huck Message-Id: <20200908193309.20569-2-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 5d56865e56..21ec63b108 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -801,8 +801,12 @@ static void virtio_iommu_device_unrealize(DeviceState = *dev) VirtIOIOMMU *s =3D VIRTIO_IOMMU(dev); =20 g_hash_table_destroy(s->as_by_busptr); - g_tree_destroy(s->domains); - g_tree_destroy(s->endpoints); + if (s->domains) { + g_tree_destroy(s->domains); + } + if (s->endpoints) { + g_tree_destroy(s->endpoints); + } =20 virtio_delete_queue(s->req_vq); virtio_delete_queue(s->event_vq); --=20 MST From nobody Sat May 4 10:02:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600448196; cv=none; d=zohomail.com; s=zohoarc; b=VmunjNRJC1CVN+TkuA2VSLUrz7045PDWCaEhLypS/D8RuK7kkU8RJe5UsuEI4d3R8TkNfLlaAosH0l14ycO1ahRxGZourDxdo2vQdBipBaEKBcglj1wHOuw34v1kv9s+D4Aeir5aKm3fTXEgv35+OQPfrwVZS4VqX8HMWjJVc8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600448196; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QGEKUXK8Ua+eb00vBAjJ3dQj8Co+dbRWsNgAI1iqUvA=; b=fEvsVQO4c7rlUj9SVhCMemUpBRsiYn4maBBL0iDtw1B6pKYFsnKu+2RhWZLU9SoB3RWnjN5lIiQ33Ncb3sLGunGf+HuwCpUsqnQvSqp1gj4Y60L6vuLaR/9m/vxM6rnfOVa4iEVWB/daSwOeViPGrNGcREbpr8tq5rzOx/C4KAA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600448196453369.30979947050344; Fri, 18 Sep 2020 09:56:36 -0700 (PDT) Received: from localhost ([::1]:39152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJgZ-0004AA-98 for importer@patchew.org; Fri, 18 Sep 2020 12:56:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJJ86-0005MJ-4U for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJJ82-0005mj-05 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 12:20:57 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-DwljGSiKNIazwWoCGqj2fg-1; Fri, 18 Sep 2020 12:20:44 -0400 Received: by mail-wr1-f69.google.com with SMTP id x15so2300927wrm.7 for ; Fri, 18 Sep 2020 09:20:44 -0700 (PDT) Received: from redhat.com (bzq-109-65-116-225.red.bezeqint.net. [109.65.116.225]) by smtp.gmail.com with ESMTPSA id a81sm6001247wmf.32.2020.09.18.09.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 09:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600446046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QGEKUXK8Ua+eb00vBAjJ3dQj8Co+dbRWsNgAI1iqUvA=; b=Qc3hI/DMJz3uv3nrc/NFPbPFeNjHfE1HfhzTi1LSJSiYhJKh/1wIkwaf+yswLiGNQ8l6A4 w3hQDAcehjYToJvG/fxmwCG+ohz9XO6CTNNMxtSvxjQhj7gnG0cC+d/eRek8W5Dn71l0wo i6HNDD+yZJr7DSQq0imjEq0/J1WUDoY= X-MC-Unique: DwljGSiKNIazwWoCGqj2fg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QGEKUXK8Ua+eb00vBAjJ3dQj8Co+dbRWsNgAI1iqUvA=; b=JDHJ50e0ZetVXTdQLkc6gfWIcO6q3WP7JbEtYWMyEo7iE/Has2tzP256aPHgz97uxV E23d4z7rNewkkungua9IiL5/gQJjd4G85rsUrur/sbimm3BOlsn+ctWaso2QQfzWZ7c7 ElRNoBF00KfKY/mAmwI9dwx+rnmJQCsco47idCzvLOpXtABSVOG8jf0GdX2C1vfsTFBD EOVlxhllxCLP0u0Qbibmp6ipVfVgtgmZ0/EQxU71Wvo187+6EVXN6Tvx3wSOeh6T+g1E t8KZ0ke/gBgvF+iCOCNhamg9F9jFRz2rUsfoclORKzc5qjrp9chTilFJsPS8qj1+aipl ub3Q== X-Gm-Message-State: AOAM530JrOzEJ/7+onX4ShWtUC6JkO1obxTiw5ECz5pHPjsTfqXLgW/8 4/UmjZwE84AWnM7KB5+UsPjMMtMQg/HAK2UHyF5T/6WochwX0uL8b5IT2jBjie5BBHScBhRlhV+ o5TDpVtvrpWeEvFQ= X-Received: by 2002:a1c:7215:: with SMTP id n21mr17314893wmc.154.1600446042607; Fri, 18 Sep 2020 09:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmmNZyrepZfY+uhU1GqPaui5C4317FGEKmGhx0yxirtrAUmWR89pmUHYvo8DIuwWyA017i3A== X-Received: by 2002:a1c:7215:: with SMTP id n21mr17314880wmc.154.1600446042391; Fri, 18 Sep 2020 09:20:42 -0700 (PDT) Date: Fri, 18 Sep 2020 12:20:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 15/15] virtio-iommu-pci: force virtio version 1 Message-ID: <20200918161836.318893-16-mst@redhat.com> References: <20200918161836.318893-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918161836.318893-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , qemu-stable@nongnu.org, Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Auger Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=3Don' on virtio-iommu-pci: qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=3Don virtio-iommu was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'. This patch forces virtio version 1 and removes the 'transitional_name' property removing the need to specify 'disable-legacy=3Don' on virtio-iommu-pci device. Cc: qemu-stable@nongnu.org Signed-off-by: Eric Auger Reviewed-by: Cornelia Huck Message-Id: <20200908193309.20569-3-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 76540e57b1..378f63b210 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -69,6 +69,7 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci= _dev, Error **errp) object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(pci_get_bus(&vpci_dev->pci_dev)), &error_abort); + virtio_pci_force_virtio_1(vpci_dev); qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } =20 @@ -98,7 +99,6 @@ static void virtio_iommu_pci_instance_init(Object *obj) static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info =3D { .base_name =3D TYPE_VIRTIO_IOMMU_PCI, .generic_name =3D "virtio-iommu-pci", - .transitional_name =3D "virtio-iommu-pci-transitional", .non_transitional_name =3D "virtio-iommu-pci-non-transitional", .instance_size =3D sizeof(VirtIOIOMMUPCI), .instance_init =3D virtio_iommu_pci_instance_init, --=20 MST