From patchwork Fri Sep 18 15:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B84A4C43463 for ; Fri, 18 Sep 2020 15:11:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1CC712388B for ; Fri, 18 Sep 2020 15:11:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L80Pt8cu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CC712388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI2v-0004iQ-6N for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:11:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxf-0006Rp-DR for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHxZ-0000W7-UB for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441560; 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=L80Pt8cuy1gk3wVa53U7Ly7w/a1LHb0F/a8tGwmkpdyTnqRaac+Wr+CJxqjRr7OWf0eg/h exuxMhHhXz0St0kLock5qTyxF+CY0ZW3hKOZSSrISV3TYDa/QAfpHO97NkV5+nG9q2FKp1 8WNrLCUeR0kS6N1i5VQC9BuRTRpaywY= 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-135-NRte4vLiMfGafFvkER4frg-1; Fri, 18 Sep 2020 11:05:57 -0400 X-MC-Unique: NRte4vLiMfGafFvkER4frg-1 Received: by mail-wm1-f72.google.com with SMTP id w3so2168308wmg.4 for ; Fri, 18 Sep 2020 08:05:57 -0700 (PDT) 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=snieg6608Ah50YXTSyjCT63TeggDKGZnuQ8hzfO9O3XI/hucfKay4tp/0PCvY4ChlO pJk1pbDXYheRBOd5gdpuXyJCeKeN4xbKEkfoctft43ozIM+8U/2M97XIUKCvyOIX4PZ+ g0dUkHCDS9NC+iR/vxD85b2+E2ioXCBH0yJJIJXQ7+a8IFZGbqcMBuQA5iRb8HGCH/+h C4RRXypgU4kdWhfJS+/eCSwHwyLx7FEUpZZfq8gzlBgneigEF/xf2AUhaXtjorMbGrwJ 3Eoyx1FcBDQnWNxu7U2+O3lHm12fPpin6NqQY1lJsdh0aM8zi+Mq3W5hfzizlFK8CCLP HA/Q== X-Gm-Message-State: AOAM532ZApgL3LbATgWX5S2sHJqKccMHBzyk2J4WRjsPTLSB4I+QFt5r kY3jiRgcl/FGUVMuoTr6jsl21jvFzMF2niUaLailqhfMNjrFY3cDgzqOAiecHeyDcxiO5NzTiXE PjW/DwQxE1QSK1hE= X-Received: by 2002:adf:cc8c:: with SMTP id p12mr39757002wrj.92.1600441554836; Fri, 18 Sep 2020 08:05:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7+xpV8os/JQVixJUwclSN3/75wn0pbDCz4ycaPuCf3slCCC9cX00EUh5aOnz1pdujsL4ClQ== X-Received: by 2002:adf:cc8c:: with SMTP id p12mr39756946wrj.92.1600441554290; Fri, 18 Sep 2020 08:05:54 -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 q4sm5515780wru.65.2020.09.18.08.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:05:53 -0700 (PDT) Date: Fri, 18 Sep 2020 11:05:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 01/15] linux headers: sync to 5.9-rc4 Message-ID: <20200918150506.286890-2-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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 , Cornelia Huck , kvm@vger.kernel.org, Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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-headers/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 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian + * index 1 = 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 */ /* * 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 */ +/* 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 /* add more to the end as needed */ @@ -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 exists 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 with a + * vendor-specific modifier, a new 'GENERIC' vendor or modifier using vendor + * 'NONE' could be considered. This should only be for obvious, exceptional + * cases to avoid polluting the 'GENERIC' namespace with modifiers which only + * apply to a single vendor. + * + * Generic names should not be used for cases where multiple hardware vendors + * 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. */ +#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 modifier) */ #define AFBC_FORMAT_MOD_BCH (1ULL << 11) +/* 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 compressed. + * 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 modifier) */ #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1) +/* + * Amlogic Video Framebuffer Compression modifiers + * + * Amlogic uses a proprietary lossless image compression protocol and format + * 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 bits + * 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 modifier. + */ +#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-headers/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; }; +/** + * 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 = 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 addition 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 = 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 addition + * 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 = 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 = 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 = 1, + ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, +}; + #define ETH_GSTRING_LEN 32 /** @@ -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 = 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, /* add new constants above here */ ETH_SS_COUNT @@ -1530,6 +1602,21 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, + ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75, + ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76, + ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77, + ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78, + ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79, + ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80, + ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81, + ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82, + ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83, + ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84, + ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85, + ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86, + ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87, + ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88, + ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89, /* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS }; diff --git a/include/standard-headers/linux/input-event-codes.h b/include/standard-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 = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ -#define SW_MAX_ 0x0f +#define SW_MACHINE_COVER 0x10 /* set = cover closed */ +#define SW_MAX_ 0x10 #define SW_CNT (SW_MAX_+1) /* diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-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; }; 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 WAY * 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" @@ -36,7 +36,7 @@ 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 @@ 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; /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ - uint32_t blk_size; + __virtio32 blk_size; /* 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; /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ uint8_t wce; uint8_t unused; /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */ - uint16_t num_queues; + __virtio16 num_queues; /* 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; /* 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/standard-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 /* - * 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 feature. + * 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 userspace) */ +#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM /* 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/standard-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 @@ 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; /* 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/standard-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; 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; /* 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) #define __NR_openat2 437 __SYSCALL(__NR_openat2, sys_openat2) diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_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/unistd_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/unistd_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/kvm.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) +/* 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-powerpc/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-powerpc/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) #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) /* 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/unistd_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/unistd_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/unistd_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/unistd_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/unistd_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 #ifdef KVM_CAP_IRQ_ROUTING 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 dirty * bitmap. */ -#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 1 +#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2 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 @@ /* Use message type V2 */ #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1 +/* IOTLB can accept batching hints */ +#define VHOST_BACKEND_F_IOTLB_BATCH 0x2 #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64) #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64) From patchwork Fri Sep 18 15:06:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5747C43463 for ; Fri, 18 Sep 2020 15:13:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36DA52388B for ; Fri, 18 Sep 2020 15:13:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EzC0eOtK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36DA52388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI55-0006Ap-1H for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyR-0006x6-Ai for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHyP-0000dP-DP for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441612; 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=EzC0eOtK0emP6KjIi+Ji41am71NNu2xK/sM9Ox0NljoV+t4cyF+/a3q8o8//sjyzQW0EjE altX+1twg7bLbmQLlV/EvWKgZiugXnkqfJCmsFJo5BUxRZJQs1XlCcRCn/1qccEz2/Eaa8 8ECjFKECyI3SwN+TijP7DL4rMsb9pbQ= 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-315-RMMAhg7aMZOvbmL5MBXrAw-1; Fri, 18 Sep 2020 11:06:50 -0400 X-MC-Unique: RMMAhg7aMZOvbmL5MBXrAw-1 Received: by mail-wr1-f72.google.com with SMTP id j7so2245336wro.14 for ; Fri, 18 Sep 2020 08:06:50 -0700 (PDT) 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=N3khXPbmOJ+oIwoBRxKZCoT8HQ2mfe2Tejf+/ypjKRDkASwClJdIrSHNPEMgzkW+oM u0kLcQKnOvvdAkKFhAu7OlrQK63mqIAjc3o3zp7PKRuRDp6hAzDqAE+3etIOscfP3H0e pfoSytM2pzwQJRZ7X46JrmK19nChS1CIL0NY5s+SHjS0Hba8q8ljanu+BatHi+tywr5h u3Tymp0V/OUcQS1QOgOt7IepBk4N/6s45jIULVW/c+60Fg7v1XzGGLzlckfqrAdaC1TK AfXJdc9W/UeoDIE6Cthhqxn5xM7/avel6EjEXRWL/Gyn/FIvGJ7DOsYm682cbVD9cAza uUiw== X-Gm-Message-State: AOAM530O7TqiQVFEw1y+Mhm0rq12CncKyDXqhoXdwet2/xpA06l1ccB6 w3o+OdVfdjCt5VBeeoosim/ozxho97qQ+g9Fadt/PAQMzVe3ELO1H1iJUTcYZ5HTq2NrCY6Q2wW dUgsYzYcbmA3Cy9Q= X-Received: by 2002:a1c:2cc4:: with SMTP id s187mr15743475wms.36.1600441609289; Fri, 18 Sep 2020 08:06:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyobroxkjxSyRPfY0xq3dAz97S1DxoqD5CcSCMwxo9YoUx6unIWVd0Vw9ep1uhi81SKIgF3Bg== X-Received: by 2002:a1c:2cc4:: with SMTP id s187mr15743453wms.36.1600441609086; Fri, 18 Sep 2020 08:06:49 -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 92sm5978638wra.19.2020.09.18.08.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:48 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 03/15] vhost-vdpa: batch updating IOTLB mappings Message-ID: <20200918150506.286890-4-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Message-ID: <20200918150647.boSYrJ3UuQnOZLQVEtRd5UNASEPsIdC1thwH9BRxVro@z> 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; 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, hwaddr iova, return ret; } +static void vhost_vdpa_listener_begin(MemoryListener *listener) +{ + struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener); + struct vhost_dev *dev = v->dev; + struct vhost_msg_v2 msg; + int fd = v->device_fd; + + if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { + return; + } + + msg.type = v->msg_type; + msg.iotlb.type = VHOST_IOTLB_BATCH_BEGIN; + + if (write(fd, &msg, sizeof(msg)) != sizeof(msg)) { + error_report("failed to write, fd=%d, errno=%d (%s)", + fd, errno, strerror(errno)); + } +} + +static void vhost_vdpa_listener_commit(MemoryListener *listener) +{ + struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener); + struct vhost_dev *dev = v->dev; + struct vhost_msg_v2 msg; + int fd = v->device_fd; + + if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { + return; + } + + msg.type = v->msg_type; + msg.iotlb.type = VHOST_IOTLB_BATCH_END; + + if (write(fd, &msg, sizeof(msg)) != sizeof(msg)) { + error_report("failed to write, fd=%d, errno=%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(MemoryListener *listener, * depends on the addnop(). */ static const MemoryListener vhost_vdpa_memory_listener = { + .begin = vhost_vdpa_listener_begin, + .commit = vhost_vdpa_listener_commit, .region_add = vhost_vdpa_listener_region_add, .region_del = 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 == VHOST_BACKEND_TYPE_VDPA); v = opaque; + v->dev = dev; dev->opaque = opaque ; vhost_vdpa_call(dev, VHOST_GET_FEATURES, &features); dev->backend_features = features; @@ -280,6 +323,28 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev, return !(status & VIRTIO_CONFIG_S_FEATURES_OK); } +static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) +{ + uint64_t features; + uint64_t f = 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 &= f; + r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features); + if (r) { + return 0; + } + + dev->backend_cap = 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 = { .vhost_set_vring_kick = vhost_vdpa_set_vring_kick, .vhost_set_vring_call = vhost_vdpa_set_vring_call, .vhost_get_features = vhost_vdpa_get_features, + .vhost_set_backend_cap = vhost_vdpa_set_backend_cap, .vhost_set_owner = vhost_vdpa_set_owner, .vhost_set_vring_endian = NULL, .vhost_backend_memslots_limit = vhost_vdpa_memslots_limit, From patchwork Fri Sep 18 15:05:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69228C43464 for ; Fri, 18 Sep 2020 15:09:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7C8B23888 for ; Fri, 18 Sep 2020 15:09:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fHkQrovO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7C8B23888 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI0Y-0001mg-Pv for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:09:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxo-0006Ud-Ig for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHxg-0000Xl-8H for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441566; 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=fHkQrovObSS9Jz8QZXCt78/wlMrDSs2UPdG6rrN+GAbb20lZ3LPIURImNfINExQWPT40jG zaYz+3s3iuhnxzi4LHJ0RODqUYG5dec4G+jkMD3qsm0ElTY72t7Bd3bwU4Mk/M2KMsq/B0 QUxhCyUV9owSMSHno4IH/O8QcOwomLk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-MBWuNL6CMHaDIe1O9qtFgg-1; Fri, 18 Sep 2020 11:06:03 -0400 X-MC-Unique: MBWuNL6CMHaDIe1O9qtFgg-1 Received: by mail-wm1-f71.google.com with SMTP id y18so1556263wma.4 for ; Fri, 18 Sep 2020 08:06:03 -0700 (PDT) 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=q+W2n0nFKrmAPAeK2/ZSRYgU2vxdbcIYifP7e83R/VgIPMchXJY3LtWsrw3p2vi5qs WH0VYamISDoN8446Vc/d4T0B08Fi2SQwUu4wjLoNi+JP55T3EokiKMAYON8lfqfm/i6a v0FJEbHQpjRqLTw2Qm1MIG/Jo1w4khrDBnMa4wXBb5qg4NwO8ZZV5kklHNaHVeHVSpT/ rF5VG/VYDtnnyZX6CBwMTDAdctSUToTES9dErwQ4W/mFPGiNU/RFPN1ih93nELzfAeDd xunrC514njJecw4C4w0GQvhforHJofPVHjRkg8g+Jcm90d5rw/Soaub8bCy+ChTp1XJC DwcA== X-Gm-Message-State: AOAM5303/EoP7hM+P+egTQkuqlRtZc2hiYW4vFuoKHNqfMVOqyYk2ewp kxIkhAS+CBxILzmEEHo7OlWajMNqXSoz0+PHi52U+BJill1dJYeaVXDer9Ei91dlDB34SDa3XL2 MWL9L2OnC0oQ2gBs= X-Received: by 2002:a7b:c938:: with SMTP id h24mr16663379wml.142.1600441561897; Fri, 18 Sep 2020 08:06:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxzFu/g4fy/QgE4IhvRGeeiT1lWBY7OIv6SK7LmwtXsV0bJc+ZMH9VMGEzFk5fY9CAIWpL4w== X-Received: by 2002:a7b:c938:: with SMTP id h24mr16663366wml.142.1600441561720; Fri, 18 Sep 2020 08:06:01 -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 q12sm5531115wrs.48.2020.09.18.08.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:00 -0700 (PDT) Date: Fri, 18 Sep 2020 11:05:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 04/15] virtio-mem: detach the element from the virtqueue when error occurs Message-ID: <20200918150506.286890-5-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 *vdev, VirtQueue *vq) if (iov_to_buf(elem->out_sg, elem->out_num, 0, &req, len) < len) { virtio_error(vdev, "virtio-mem protocol violation: invalid request" " size: %d", len); + virtqueue_detach_element(vq, elem, 0); g_free(elem); return; } @@ -327,6 +328,7 @@ static void virtio_mem_handle_request(VirtIODevice *vdev, 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 *vdev, VirtQueue *vq) default: virtio_error(vdev, "virtio-mem protocol violation: unknown request" " type: %d", type); + virtqueue_detach_element(vq, elem, 0); g_free(elem); return; } From patchwork Fri Sep 18 15:06:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EB4CC43463 for ; Fri, 18 Sep 2020 15:13:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B881E2388B for ; Fri, 18 Sep 2020 15:13:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UQIiQBY4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B881E2388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI4w-0005tl-Fn for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:13:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxo-0006V4-US for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHxl-0000Xs-Ay for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441568; 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=XM7OAmXTOk6Dn4Gfks418JOy4EEvHfub5qqdEwcobzE=; b=UQIiQBY4LSGWsR3Sm8O6xKLWsweA+sKYwgK8K7Hdi7+JL2kDpagP/hoquxJs6bb/Y2PiUd QSrigaMukSus2CpieYkaC8gvW2YbPHhQAXYm6H6DMaZ7Q/ETSmJgnU6ikQUWJmSRQdmSIw 72krfuboQ+uYjyFMA0+8Upo6Sh11vI8= 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-213-ysKByWEkM4GkSNGHuGr5Bg-1; Fri, 18 Sep 2020 11:06:06 -0400 X-MC-Unique: ysKByWEkM4GkSNGHuGr5Bg-1 Received: by mail-wr1-f70.google.com with SMTP id v12so2240930wrm.9 for ; Fri, 18 Sep 2020 08:06:06 -0700 (PDT) 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=XM7OAmXTOk6Dn4Gfks418JOy4EEvHfub5qqdEwcobzE=; b=LuGVXhhAX8fXXOk3PNsxF0Xrlhy/5DuUX/EBZlREIYL0tTj7bCfm2yDLxvvYKqS0M5 1MvYnbVu64wXp8XYfLlntWo2tazKpj1AwFVzjzMpfUK+fJ3q6B0NR5j5YznfqjLE3uIl QXd+BkEd8W7wiVenrjc7h1ddxh4G+EiMpze/z+KoxqEwY/TQLhER9TLfNR33OM+5Ujyr gPqSLmP2PmqsZwIHZT7W4bA8g2c0AQ7LOgZrc8Y+m0NzpiwKWcRKf2tpxWFBbIoXljvP m7tRV/bboTVdrzZNAbVT+CKIB/GHdMzn3JXLhQ1t9PU6m3+/UA/wGNBdgEkSP4O8EDw3 n+Bw== X-Gm-Message-State: AOAM530xWPOVvA1PUnjBopZ7ifUUkl0T0DqGhiZxfHV5i4B0FGGYtmaC mqDTE2QE+3/0906HujsJQ+y2+RvwXzThwfIvW/m/lJvIvPSPb5cCGGtKFkvoW2RWU4jVd9BBUQ7 jMKK/zFBB4KZfOCg= X-Received: by 2002:a1c:3b09:: with SMTP id i9mr15605302wma.43.1600441564895; Fri, 18 Sep 2020 08:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzarNa7A1XKUaJ941x5tw5No7cgXMhPmdDp3XgFKqUe7eiisf9aKzOIc+0+Q8yPlGLmqEvlww== X-Received: by 2002:a1c:3b09:: with SMTP id i9mr15605274wma.43.1600441564683; Fri, 18 Sep 2020 08:06:04 -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 d83sm5668107wmf.23.2020.09.18.08.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:04 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 05/15] pc: fix auto_enable_numa_with_memhp/auto_enable_numa_with_memdev for the 5.0 machine Message-ID: <20200918150506.286890-6-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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 , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, "Dr . David Alan Gilbert" , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 possible) 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 0cb9c18cd4..b95759df60 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 = 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 = false; + m->auto_enable_numa_with_memdev = false; } DEFINE_Q35_MACHINE(v5_0, "pc-q35-5.0", NULL, From patchwork Fri Sep 18 15:06:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7798AC43464 for ; Fri, 18 Sep 2020 15:16:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D83D323888 for ; Fri, 18 Sep 2020 15:16:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V2gOfWUF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D83D323888 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI7I-0000CZ-Iv for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:16:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxt-0006Zu-4d for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44083 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 1kJHxm-0000YD-4B for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441572; 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=LWfXGcJUqmqnQm73g6R37Nb0eDstIXJBzwfXH66PjOk=; b=V2gOfWUFNZkiJQnO3r51bSxbX3aFMxBonJeDKSwYJorTF2K0vgKwsvLhJFZpoHJVzQ+oPm SVfRce7dFBIafdEDnl9i8xqWCmB/tXE/QgJElGCxGNF08TcqvCrbws0TIEvW0y7TNgKoHd qHEPip/id7IHJDOkLp+ygQ534Cpwx1o= 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-578-_3IXzmXCMxCoUgFuTC7Uow-1; Fri, 18 Sep 2020 11:06:09 -0400 X-MC-Unique: _3IXzmXCMxCoUgFuTC7Uow-1 Received: by mail-wr1-f69.google.com with SMTP id g6so2249190wrv.3 for ; Fri, 18 Sep 2020 08:06:09 -0700 (PDT) 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=LWfXGcJUqmqnQm73g6R37Nb0eDstIXJBzwfXH66PjOk=; b=ANRlnFfVmBPWprFWCmf93mYAZl4MudZKDwLZf4dRK1f0/ZnHlMnx49ih8WLfMJy1X6 A/jcXUNHYLMgtVuFxvFHBfyCKyiMVE4CLGw2AQjfjMRJy2Yfkh9m9l8cUp84xt7BOwrt xYZX8YMRsPcTmaauNUNKtyqsn1MwPk7MInhZhLewvyXAZm2v1Bv9/tQP8Tojnb8Att3z sF4K5ePb4/QxZUCu/KUj3uoAsjrwlO7lLVE06FtbJUCMPetVOHVpjBQmIwpGjyhRhbAG jsmJhaQ4Ylk0ts2VZOBmZrcUzd8KENTjOGG6Xxg9mjfuuHzVNuUAzLlLuNlsVqGtfX64 B18w== X-Gm-Message-State: AOAM5313inGwblYsQjz0WzlBjAv1HibTqlhV7kTpSxAJfyZkv+s3kmGm AG7IDvWe685oFrVd3CVkNt+jC+UE0l11wdhkUTtRyGHYOm03DrZDpnkqIuF5bkGk6dkh9gcu/C4 I/M9N8W9n0hxbwZQ= X-Received: by 2002:adf:e449:: with SMTP id t9mr38873724wrm.154.1600441567795; Fri, 18 Sep 2020 08:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtDPhEUn/srHYg56WnUxmYX/I45sCVEYiTgFggwfovQJkuDLEUKbNk9mDYI52djlCKO0CE6g== X-Received: by 2002:adf:e449:: with SMTP id t9mr38873697wrm.154.1600441567535; Fri, 18 Sep 2020 08:06: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 u12sm5626173wrt.81.2020.09.18.08.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:06 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 06/15] vhost: recheck dev state in the vhost_migration_log routine Message-ID: <20200918150506.286890-7-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 client-ip=205.139.110.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 08:09:31 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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=0x563989cf7be0) at hw/virtio/vhost.c:920 #1 0x000056398603d8bc in listener_add_address_space (listener=0x563989cf7be0, as=0x563986ea4340 ) at softmmu/memory.c:2664 #2 0x000056398603dd30 in memory_listener_register (listener=0x563989cf7be0, as=0x563986ea4340 ) at softmmu/memory.c:2740 #3 0x0000563985fd6956 in vhost_dev_init (hdev=0x563989cf7bd8, opaque=0x563989cf7e30, backend_type=VHOST_BACKEND_TYPE_USER, busyloop_timeout=0) at hw/virtio/vhost.c:1385 #4 0x0000563985f7d0b8 in vhost_user_blk_connect (dev=0x563989cf7990) at hw/block/vhost-user-blk.c:315 #5 0x0000563985f7d3f6 in vhost_user_blk_event (opaque=0x563989cf7990, event=CHR_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 Message-Id: Reviewed-by: Raphael Norwitz 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-user-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; }; #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 = true; /* 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 = VIRTIO_BUS_GET_CLASS(qbus); int ret; + if (!s->started_vu) { + return; + } + s->started_vu = false; + if (!k->set_guest_notifiers) { return; } @@ -341,9 +347,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev) } s->connected = false; - if (s->dev.started) { - vhost_user_blk_stop(vdev); - } + vhost_user_blk_stop(vdev); vhost_dev_cleanup(&s->dev); } @@ -399,6 +403,15 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) NULL, NULL, false); aio_bh_schedule_oneshot(ctx, vhost_user_blk_chr_closed_bh, opaque); } + + /* + * 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 = 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 *listener, bool enable) dev->log_enabled = enable; return 0; } + + r = 0; if (!enable) { r = 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 = vhost_dev_set_log(dev, true); if (r < 0) { - return r; + goto check_dev_state; } } + +check_dev_state: dev->log_enabled = 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 = 0; + } + if (r) { + /* An error is occured. */ + dev->log_enabled = false; + } + + return r; } static void vhost_log_global_start(MemoryListener *listener) From patchwork Fri Sep 18 15:06:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB4CC43464 for ; Fri, 18 Sep 2020 15:12:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB88023888 for ; Fri, 18 Sep 2020 15:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QZ9hl5Zh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB88023888 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI3y-0005Mb-Qt for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxx-0006aH-Vh for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHxo-0000YM-6r for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441573; 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=6NfdktJge9yb9E6AqjpIh53ZkYpwE8OXxtfPUIP1V1Q=; b=QZ9hl5ZhWGJybXAIvxUoxyr+NoJMWZjOe0rvUqN9pq+TZIxAoDt9aMKFB4wcCjYe+XMVK4 T7kuD2ppSNvjHmsnHZVTf23I0deWfo2rtAaXFyYpnNExfLKsqaDFP4e00eTCs3gPcJ4Cpw AwbfyP7+JJSohdnkuOxhVAdv0V2evyk= 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-144-V_l6MZP1M56ibY9SVdCflw-1; Fri, 18 Sep 2020 11:06:11 -0400 X-MC-Unique: V_l6MZP1M56ibY9SVdCflw-1 Received: by mail-wr1-f69.google.com with SMTP id f18so2234023wrv.19 for ; Fri, 18 Sep 2020 08:06:11 -0700 (PDT) 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=6NfdktJge9yb9E6AqjpIh53ZkYpwE8OXxtfPUIP1V1Q=; b=traTPPHqaZ6NXl6uGyrGhFL+EawhaTz8GRtBF4Dd81IT1U3oweK1UwnVwqCCeE3eN/ yPMcSpnR6zQ58meovPy7RZZMoVhtLhseB8VLLTf1x/UTeWMdzYTgnVhfwqAFeg5KHZ1/ rwPMsMhCeRJZ4TjqAoAqa/MTZHdITkKjX+20EdaRALfULx/0P/mj0SIdatnGNn2dxDah 8Fg2aMiLzgQW4f1iwRToRLrmPXyl7RJ0KVZg+gvPxYsTCSVOTOJxwO9/NUW3I9cYUi2J /fTDOu9OPirn8hXcLhyG1iA3BYcb8D5M2Ae1D+o7IWhsnrW5FMjRkbsBmWIK+6gcY/cQ 4zNw== X-Gm-Message-State: AOAM532JnEf1H88etMNZmPLFthWO9HERAHgte7RHQKcNqLWQvV1YeqjE LDTzBkdyPDlH2ND4mdq12bRUmvd7IuvO6LF7E0NKDLD0s34F/Zp1Atcs+iYZiR0NWfAHvMnswHB DEhr6v2mJFc4GvZ0= X-Received: by 2002:adf:f084:: with SMTP id n4mr14810604wro.26.1600441570160; Fri, 18 Sep 2020 08:06:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6z8usrvNebtrJsSon/SOh/ASXGs306FfAqLWmDSsB6Wwmi5OyarYlEY+O413MRK9s9ueVaQ== X-Received: by 2002:adf:f084:: with SMTP id n4mr14810580wro.26.1600441569956; Fri, 18 Sep 2020 08:06:09 -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 m1sm5206846wmc.28.2020.09.18.08.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:09 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:07 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 07/15] vhost: check queue state in the vhost_dev_set_log routine Message-ID: <20200918150506.286890-8-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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 Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: <2da64fc45789094b6bd6f1c283cac9e47eeeb786.1598865610.git.dimastep@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..abe0fe3e67 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 = vhost_dev_set_features(dev, enable_log); if (r < 0) { goto err_features; } for (i = 0; i < dev->nvqs; ++i) { idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i); + addr = 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. + */ + break; + } r = vhost_virtqueue_set_addr(dev, dev->vqs + i, idx, enable_log); if (r < 0) { From patchwork Fri Sep 18 15:06:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCEE9C43463 for ; Fri, 18 Sep 2020 15:16:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B720A2389E for ; Fri, 18 Sep 2020 15:16:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VK0cKf26" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B720A2389E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI7s-0000tZ-NT for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:16:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHxz-0006b6-FU for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHxq-0000Ys-P8 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441578; 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=3P+XMPk5537Wkf305VRwwfomGxBN6MfFgoWb0HRFKr4=; b=VK0cKf26mn5NvaOhGRutwcaCt/No0shWsNUt0ATN0fmVoko156uk6QLZ0ul6lnIUin/4cK 9n2W+ITHjczNpRqhU3MCS8V5+AZ4FzzDR3TRh07kBMgMtekJ6mPBeqTiKgFPQWsGTYjo1O fO11ufYFNyIR5XLCesXmaV3dr2+Ihgo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-yQwdJLkEOKaPM7Dd9OqfPQ-1; Fri, 18 Sep 2020 11:06:14 -0400 X-MC-Unique: yQwdJLkEOKaPM7Dd9OqfPQ-1 Received: by mail-wm1-f71.google.com with SMTP id a7so2171115wmc.2 for ; Fri, 18 Sep 2020 08:06:14 -0700 (PDT) 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=3P+XMPk5537Wkf305VRwwfomGxBN6MfFgoWb0HRFKr4=; b=ZzQUOoLgW7p3FuEwM2K66UfCl7KaxPccJQG8pTT2ptUfHjtU0yjjxnpjRf86tN9mi0 TOazuXaNth0Lnymjk4Z3UKqEVbAe4steoh2yu22eOeFSKG9q0pwYuKV8Lt5Ew1CRE1dn jbhIcPOqNPYUMB/evH4uJ6tBaZZubT2hqgheCmCr7IYtYdk+4VCV5f0q5UlY4+ancv8j Hnr7mFbuAoAhBHSlMyISzrhuaA3pAu33IwvtHag02IBOKsmQ2X9FFDTNPZpcF3kTaihI KwvTCu5WpjtfIblKMTZ4PBSW0qR65S6llwEzjnDHX+H7DXZttiA+UifkTfMz+WiKdPQ2 SrTQ== X-Gm-Message-State: AOAM53303EWZKxSEM2QYN+LTuALFsvpozqm3kJ6nO2dkCAw1U/0q1pWU EhSvc0utzyBienV8UqokYaRH+MgmH6HYCHjbNuRWS68gH6OeGVliCV2kaLjIjpBHncaqcTeTwd3 mdFgXkyNIH0pfjA0= X-Received: by 2002:a1c:66c4:: with SMTP id a187mr15662388wmc.148.1600441572907; Fri, 18 Sep 2020 08:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk5IohHlvRly8hh6HHGrHX4ch0SlzNDYRaaxskehlsuAsuqixXSvkK/1jMPaie8XQTNqTJsg== X-Received: by 2002:a1c:66c4:: with SMTP id a187mr15662361wmc.148.1600441572662; Fri, 18 Sep 2020 08:06:12 -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 h76sm5957739wme.10.2020.09.18.08.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:12 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 08/15] tests/qtest/vhost-user-test: prepare the tests for adding new dev class Message-ID: <20200918150506.286890-9-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: <769cf817bad80e2534093e5887837b1c5e4675e2.1598865610.git.dimastep@yandex-team.ru> 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, }; +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; +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); @@ -167,7 +186,7 @@ enum test_memfd { TEST_MEMFD_NO, }; -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; case VHOST_USER_SET_FEATURES: - g_assert_cmpint(msg.payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), - !=, 0ULL); - if (s->test_flags == TEST_FLAGS_DISCONNECT) { - qemu_chr_fe_disconnect(chr); - s->test_flags = TEST_FLAGS_BAD; + if (s->vu_ops->set_features) { + s->vu_ops->set_features(s, chr, &msg); } break; case VHOST_USER_GET_PROTOCOL_FEATURES: - /* send back features to qemu */ - msg.flags |= VHOST_USER_REPLY_MASK; - msg.size = sizeof(m.payload.u64); - msg.payload.u64 = 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; - msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; - if (s->queues > 1) { - msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_MQ; + if (s->vu_ops->get_protocol_features) { + s->vu_ops->get_protocol_features(s, chr, &msg); } - p = (uint8_t *) &msg; - qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; case VHOST_USER_GET_VRING_BASE: @@ -467,7 +476,8 @@ static const char *init_hugepagefs(void) #endif } -static TestServer *test_server_new(const gchar *name) +static TestServer *test_server_new(const gchar *name, + struct vhost_user_ops *ops) { TestServer *server = g_new0(TestServer, 1); char template[] = "/tmp/vhost-test-XXXXXX"; @@ -495,6 +505,7 @@ static TestServer *test_server_new(const gchar *name) server->log_fd = -1; server->queues = 1; + server->vu_ops = ops; return server; } @@ -669,11 +680,11 @@ static void vhost_user_test_cleanup(void *s) static void *vhost_user_test_setup(GString *cmd_line, void *arg) { - TestServer *server = test_server_new("vhost-user-test"); + TestServer *server = test_server_new("vhost-user-test", arg); test_server_listen(server); append_mem_opts(server, cmd_line, 256, TEST_MEMFD_AUTO); - append_vhost_opts(server, cmd_line, ""); + server->vu_ops->append_opts(server, cmd_line, ""); g_test_queue_destroy(vhost_user_test_cleanup, server); @@ -682,11 +693,11 @@ static void *vhost_user_test_setup(GString *cmd_line, void *arg) static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg) { - TestServer *server = test_server_new("vhost-user-test"); + TestServer *server = test_server_new("vhost-user-test", arg); test_server_listen(server); append_mem_opts(server, cmd_line, 256, TEST_MEMFD_YES); - append_vhost_opts(server, cmd_line, ""); + server->vu_ops->append_opts(server, cmd_line, ""); g_test_queue_destroy(vhost_user_test_cleanup, server); @@ -720,7 +731,7 @@ static void test_migrate(void *obj, void *arg, QGuestAllocator *alloc) return; } - dest = test_server_new("dest"); + dest = test_server_new("dest", s->vu_ops); dest_cmdline = g_string_new(qos_get_current_command_line()); uri = g_strdup_printf("%s%s", "unix:", dest->mig_path); @@ -730,7 +741,7 @@ static void test_migrate(void *obj, void *arg, QGuestAllocator *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 = qtest_init(dest_cmdline->str); /* This would be where you call qos_allocate_objects(to, NULL), if you want @@ -831,11 +842,11 @@ connect_thread(gpointer data) static void *vhost_user_test_setup_reconnect(GString *cmd_line, void *arg) { - TestServer *s = test_server_new("reconnect"); + TestServer *s = test_server_new("reconnect", arg); 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"); g_test_queue_destroy(vhost_user_test_cleanup, s); @@ -866,13 +877,13 @@ static void test_reconnect(void *obj, void *arg, QGuestAllocator *alloc) static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *arg) { - TestServer *s = test_server_new("connect-fail"); + TestServer *s = test_server_new("connect-fail", arg); s->test_fail = true; 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"); g_test_queue_destroy(vhost_user_test_cleanup, s); @@ -881,13 +892,13 @@ static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *arg) static void *vhost_user_test_setup_flags_mismatch(GString *cmd_line, void *arg) { - TestServer *s = test_server_new("flags-mismatch"); + TestServer *s = test_server_new("flags-mismatch", arg); s->test_flags = TEST_FLAGS_DISCONNECT; 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"); g_test_queue_destroy(vhost_user_test_cleanup, s); @@ -924,11 +935,47 @@ static void test_multiqueue(void *obj, void *arg, QGuestAllocator *alloc) wait_for_rings_started(s, s->queues * 2); } +static void vu_net_set_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + g_assert_cmpint(msg->payload.u64 & + (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=, 0ULL); + if (s->test_flags == TEST_FLAGS_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags = TEST_FLAGS_BAD; + } +} + +static void vu_net_get_protocol_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + /* send back features to qemu */ + msg->flags |= VHOST_USER_REPLY_MASK; + msg->size = sizeof(m.payload.u64); + msg->payload.u64 = 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg->payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; + if (s->queues > 1) { + msg->payload.u64 |= 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 = { + .type = VHOST_USER_NET, + + .append_opts = append_vhost_net_opts, + + .set_features = vu_net_set_features, + .get_protocol_features = vu_net_get_protocol_features, +}; + static void register_vhost_user_test(void) { QOSGraphTestOptions opts = { .before = vhost_user_test_setup, .subprocess = true, + .arg = &g_vu_net_ops, }; qemu_add_opts(&qemu_chardev_opts); From patchwork Fri Sep 18 15:06:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7022C43463 for ; Fri, 18 Sep 2020 15:09:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 198872395C for ; Fri, 18 Sep 2020 15:09:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dgCGo7i5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 198872395C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI0X-0001iu-St for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:09:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHy2-0006cF-CA for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32500 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 1kJHxx-0000ZJ-N8 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441582; 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=eNjevSPQ6R0xqmmfoOyjpswokZGIHXQPWEYyjWczdt0=; b=dgCGo7i54OriYfYsF1j9u4Z8WnVkBujMovExKqJWUH2+ROho5Nvg4vqPUw6uVR0uUOKbxf BegC5g1YLKkzXOSIocxJAkf/DWiV4ENdgiVbPDMqbj7/jWP9I1sktDDsws9kPS0efPLleA Il2/6fCFUQdWqJ+Axd+REg1pgMHNKRQ= 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-517-k8lSkUFuMTy3bqQfbhCAhQ-1; Fri, 18 Sep 2020 11:06:17 -0400 X-MC-Unique: k8lSkUFuMTy3bqQfbhCAhQ-1 Received: by mail-wm1-f72.google.com with SMTP id a25so1560438wmb.2 for ; Fri, 18 Sep 2020 08:06:17 -0700 (PDT) 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=eNjevSPQ6R0xqmmfoOyjpswokZGIHXQPWEYyjWczdt0=; b=Qx3giyyxaHwEdFUnremxBXaSHgouzr8wbVI5o8oe6dNVo+ePCF9tngEJPPXR2pweRk iPZiy0+QJCzGaScCvxMof/rJg4bhJR206vI761rK7RiqqFli8BWzj0YDjKyF75NmuCoh NJdzfmIgqJZ8mGz1++ANsFQwG/oQWDwdzBCRfNTUDtaUN1mdmcPP4afg2JNCcfXdvJhp 1ocdZoTXwL+ukEYGas/cBsGBaSbilpXKILvKrtReGyNFgwXHJYsw5f4D026MHXF0zFNj TL218AT/W5+r5KUu2+7ATu7g4Fz6ZvmDn+nbTqutes51+pCroTsnkl9l+sFG5SzyLJUG vACg== X-Gm-Message-State: AOAM531AHCaMbyAasjMV9BweDWQxVD9tvECyZ0K3jrl9807cSo9Pl8pa SPDSxgJhH86wFCMqNtQvluiDrv47N1xRkWcgeuBqwWmwcr0IshmOsF+PiiCLk2SdXn06jrEZrlS N5Hm+mgEUgN3rjqo= X-Received: by 2002:a1c:7912:: with SMTP id l18mr16001092wme.124.1600441575398; Fri, 18 Sep 2020 08:06:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvaDVoS5HmvayC4gb29hj45kW67SS7bSYiBnAycJGvKG+yyq5qW65SJKFQdItgGRR96LFpSg== X-Received: by 2002:a1c:7912:: with SMTP id l18mr16001065wme.124.1600441575175; Fri, 18 Sep 2020 08:06: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 a10sm5349670wmj.38.2020.09.18.08.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:14 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 09/15] tests/qtest/libqos/virtio-blk: add support for vhost-user-blk Message-ID: <20200918150506.286890-10-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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 , Dima Stepanov , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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: <50d827a7b383de531ac1452e1e0ce3ad961d00af.1598865610.git.dimastep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/libqos/virtio-blk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/libqos/virtio-blk.c b/tests/qtest/libqos/virtio-blk.c index 5da02591bc..959c5dce18 100644 --- a/tests/qtest/libqos/virtio-blk.c +++ b/tests/qtest/libqos/virtio-blk.c @@ -36,6 +36,9 @@ static void *qvirtio_blk_get_driver(QVirtioBlk *v_blk, if (!g_strcmp0(interface, "virtio")) { return v_blk->vdev; } + if (!g_strcmp0(interface, "vhost-user-blk")) { + return v_blk; + } fprintf(stderr, "%s not present in virtio-blk-device\n", interface); g_assert_not_reached(); @@ -120,6 +123,17 @@ static void virtio_blk_register_nodes(void) qos_node_produces("virtio-blk-pci", "virtio-blk"); g_free(arg); + + /* vhost-user-blk-pci */ + arg = g_strdup_printf("id=drv0,chardev=chdev0,addr=%x.%x", + PCI_SLOT, PCI_FN); + opts.extra_device_opts = 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); } libqos_init(virtio_blk_register_nodes); From patchwork Fri Sep 18 15:06:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF9C7C43463 for ; Fri, 18 Sep 2020 15:19:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C97CF2388B for ; Fri, 18 Sep 2020 15:19:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ST0xNiCw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C97CF2388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIB0-0004zo-RI for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:19:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJI0b-0002Ql-KB for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:09:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJI0Z-0000rx-7Q for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:09:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441746; 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=ZoalVdKOwt7sVgHRaOMyNa8oQ6g6ikDqLNZadE+Dcwg=; b=ST0xNiCwFZCLnArzdWj7tEVKf0/joy9AbEEmgeDJp+1mvShcH3zfi62sWKmcIv++oqqYMH 2Fl8Sgx23lSoFpfg5A21A9dzrPOIy1IUUC7VaflMiEh9TdpO8UmEfPtNPShWbkl5qUa01Z /GOXvGQy6aJgbS5PWO3ieQSxzVa2Epg= 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-330-19koaB4UO5K_aWXRI0wlug-1; Fri, 18 Sep 2020 11:06:20 -0400 X-MC-Unique: 19koaB4UO5K_aWXRI0wlug-1 Received: by mail-wm1-f72.google.com with SMTP id s24so1560091wmh.1 for ; Fri, 18 Sep 2020 08:06:20 -0700 (PDT) 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=ZoalVdKOwt7sVgHRaOMyNa8oQ6g6ikDqLNZadE+Dcwg=; b=QI+x8mLwZX0gFjS3pgmDGFFI9XgdJEU4rUnt3zwIfgRLEXF0R4uMUwthXZuxiwF7ub mpC6RN1jUp5vtd1lUB4dtGA4nnMLXHyT5szQMk0KrdJ8LC+YR68rtl9RFlGZ9x/3DnJs CJ3V2WxD7GQ6hTE7WcBdNrvWvuSDovn8bM1FFAa99GycTU5qKO2pKl/id9MkXt9rxTNJ /W0mjNLPDJfTooAGmCFuXRo7LsCXOcrx0se3U+bRIQxQJSJN8ZXnx8ppwvWy+dwnb2b/ 17/4tk/Pm6nftYSwy93LqGGT6JMXdGC9SUwh0OHTdVzuEmsl9WirZIxcHQROyfjY3TFN TH+g== X-Gm-Message-State: AOAM531LYYvMUVxkGWfFnmpUaN9UtxQPctHtkb05/z3rrgUWZowUn8nR RyWBfo5Se2qyCsqnD4RvLHEwqD9v18Ei3iO6qrAk/Ebf1NT/Ejea3in98ZD++bIALV85ZZ/yqDd R2MyRiQvPFtHiwLA= X-Received: by 2002:adf:e601:: with SMTP id p1mr41172270wrm.172.1600441578510; Fri, 18 Sep 2020 08:06:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVftSVbl+5jNtMLMirXo/u8ABbbXXPjrpKBGGI3KEKNmIb2SYyfklg4McjlyH6BG2F+FZjvg== X-Received: by 2002:adf:e601:: with SMTP id p1mr41172241wrm.172.1600441578249; Fri, 18 Sep 2020 08:06:18 -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 f1sm5373048wrx.75.2020.09.18.08.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:17 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 10/15] tests/qtest/vhost-user-test: add support for the vhost-user-blk device Message-ID: <20200918150506.286890-11-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: <960720d82815926a648a3688bf6a38887eb0bf8e.1598865610.git.dimastep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 138 +++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 3df5322614..91f8cfda12 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" #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" #ifdef CONFIG_LINUX #include @@ -43,6 +45,7 @@ " -numa node,memdev=mem" #define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce" +#define QEMU_CMD_BLKCHR " -chardev socket,id=chdev0,path=%s%s" #define HUGETLBFS_MAGIC 0x958458f6 @@ -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 #define VHOST_LOG_PAGE 0x1000 @@ -78,6 +82,8 @@ typedef enum VhostUserRequest { VHOST_USER_SET_PROTOCOL_FEATURES = 16, VHOST_USER_GET_QUEUE_NUM = 17, VHOST_USER_SET_VRING_ENABLE = 18, + VHOST_USER_GET_CONFIG = 24, + VHOST_USER_SET_CONFIG = 25, VHOST_USER_MAX } VhostUserRequest; @@ -99,6 +105,14 @@ typedef struct VhostUserLog { uint64_t mmap_offset; } VhostUserLog; +#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; @@ -114,6 +128,7 @@ typedef struct VhostUserMsg { struct vhost_vring_addr addr; VhostUserMemory memory; VhostUserLog log; + VhostUserConfig config; } payload; } QEMU_PACKED VhostUserMsg; @@ -137,6 +152,7 @@ enum { enum { VHOST_USER_NET, + VHOST_USER_BLK, }; 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); /* 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); }; static const char *init_hugepagefs(void); @@ -194,6 +213,14 @@ static void append_vhost_net_opts(TestServer *s, GString *cmd_line, chr_opts, s->chr_name); } +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; + 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, QGuestAllocator *alloc) guint8 *log; guint64 size; + 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, QGuestAllocator *alloc) g_string_free(dest_cmdline, true); } +static void vu_blk_driver_init(void *obj, QGuestAllocator *alloc) +{ + QVirtioBlk *blk_if; + QVirtioDevice *dev; + QVirtQueue *vq; + uint64_t features; + + blk_if = obj; + dev = blk_if->vdev; + features = qvirtio_get_features(dev); + qvirtio_set_features(dev, features); + + vq = 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, QGuestAllocator *alloc) { TestServer *s = arg; GSource *src; + int nq; + if (s->vu_ops->driver_init) { + s->vu_ops->driver_init(obj, alloc); + } if (!wait_for_fds(s)) { return; } - wait_for_rings_started(s, 2); + nq = 1; + if (s->vu_ops->type == VHOST_USER_NET) { + /* tx and rx queues */ + nq = 2; + } + wait_for_rings_started(s, nq); /* reconnect */ s->fds_num = 0; @@ -872,7 +935,7 @@ static void test_reconnect(void *obj, void *arg, QGuestAllocator *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); } static void *vhost_user_test_setup_connect_fail(GString *cmd_line, void *arg) @@ -960,6 +1023,55 @@ 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); } +static void vu_blk_set_features(TestServer *s, CharBackend *chr, + VhostUserMsg *msg) +{ + if (s->test_flags == TEST_FLAGS_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags = TEST_FLAGS_BAD; + } +} + +static void vu_blk_get_protocol_features(TestServer *s, + CharBackend *chr, VhostUserMsg *msg) +{ + /* send back features to qemu */ + msg->flags |= VHOST_USER_REPLY_MASK; + msg->size = sizeof(m.payload.u64); + msg->payload.u64 = 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg->payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_CONFIG; + if (s->queues > 1) { + msg->payload.u64 |= 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) +{ + struct virtio_blk_config *blk_config; + + memset(&msg->payload.config, 0, sizeof(msg->payload.config)); + msg->payload.config.size = sizeof(*blk_config); + + blk_config = (struct virtio_blk_config *)&msg->payload.config.region; + /* + * Represent 128Mb test disk, with no real backend, just + * to test vhost-user functionality. + */ + blk_config->capacity = 262144; + blk_config->size_max = 0x20000; + blk_config->seg_max = 0x7e; + blk_config->blk_size = 512; + blk_config->min_io_size = 0x1; + blk_config->num_queues = 0x1; + + msg->size = sizeof(msg->payload.config) - + sizeof(msg->payload.config.region) + msg->payload.config.size; + msg->flags |= 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 = { .type = VHOST_USER_NET, @@ -970,6 +1082,17 @@ static struct vhost_user_ops g_vu_net_ops = { .get_protocol_features = vu_net_get_protocol_features, }; +static struct vhost_user_ops g_vu_blk_ops = { + .type = VHOST_USER_BLK, + + .append_opts = append_vhost_blk_opts, + .driver_init = vu_blk_driver_init, + + .set_features = vu_blk_set_features, + .get_protocol_features = vu_blk_get_protocol_features, + .get_config = vu_blk_get_config, +}; + static void register_vhost_user_test(void) { QOSGraphTestOptions opts = { @@ -1015,5 +1138,16 @@ static void register_vhost_user_test(void) qos_add_test("vhost-user/multiqueue", "virtio-net", test_multiqueue, &opts); + opts.edge.extra_device_opts = NULL; + + /* vhost-user-blk tests */ + opts.arg = &g_vu_blk_ops; + opts.before = vhost_user_test_setup_reconnect; + qos_add_test("reconnect", "vhost-user-blk", + test_reconnect, &opts); + + opts.before = vhost_user_test_setup_memfd; + qos_add_test("migrate", "vhost-user-blk", + test_migrate, &opts); } libqos_init(register_vhost_user_test); From patchwork Fri Sep 18 15:06:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B956DC43464 for ; Fri, 18 Sep 2020 15:19:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3409C2388B for ; Fri, 18 Sep 2020 15:19:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bqphy2uV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3409C2388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIAN-0004Fu-64 for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:19:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyA-0006eM-DP for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHy2-0000Zh-3U for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441587; 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=ChTCKXA6i09l/SD0XdTTHfgAwPsIIKbguO/mCSNhkkQ=; b=Bqphy2uV0d1wGyYRQql+qd8RfSLkQdxQWqb4FCnbuF7V3v6Rlvy0Ym5ty8ljZgby8EUPvQ aEmdFbyt/ZEP8hGOn0muDdZKR3zTEjn0w1VpfdGYFJj0yU+WozdW6UdMBky8+zTSTIwRhX JujmTmJ1EhUowHqgMPrdrlhiSk/kY8w= 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-215-Ji2_zXRONJqOECkBJPZYEg-1; Fri, 18 Sep 2020 11:06:22 -0400 X-MC-Unique: Ji2_zXRONJqOECkBJPZYEg-1 Received: by mail-wr1-f71.google.com with SMTP id i10so2238616wrq.5 for ; Fri, 18 Sep 2020 08:06:22 -0700 (PDT) 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=ChTCKXA6i09l/SD0XdTTHfgAwPsIIKbguO/mCSNhkkQ=; b=RzQI+JO2MAEA+Fi/j/t7YKsnmqOlvmAzFssOvazB4PKDTbpx2O9fxLd/cDeclPtqMT sXb/Kf5EWmv0QypKk8sg1f9Ky6Rtu4mwcWUb3GQ4ulDeDPSEHVupRmoz3SLYlbTd4Rii VtEx+DethVAXsxs/nnu3lsnIPghKAUUBEtAPrZo8hirRXeBLyi36HL0tXi6VQP8NH4OW kyENYHJ18arfLcmm63enh6SDDWe0Pw1u8rMYf0SMlv6GqcSgRpXKnHJTmASVdxyC+E0G kL9j2uE+IOp2P8IAKyI6jJtsOXdx+P0Ft4YQzm2IV3BK2++6Mjd1YC/2CLtzvvWbAXw8 lEqA== X-Gm-Message-State: AOAM532x6OdXSsvE1bgidrtG7ITT1H4eSql32vI7xxXJU8LFRXABTzY+ o1Y3buFAUjkmm6VvYB3yh2yGCg6M429dPsIqtmRZEKub7LV29rUijKD33q3xeft7nsZwGy1K3lW vojtxKtYNd7mbfKg= X-Received: by 2002:adf:aadb:: with SMTP id i27mr29617580wrc.258.1600441581164; Fri, 18 Sep 2020 08:06:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLJAjEdMkeJzmqzsDojLLXhUuzTxXeP6ZZKRiuFd+/Lx4hvbShUdgyTehB+WYp/jnN4ayvrw== X-Received: by 2002:adf:aadb:: with SMTP id i27mr29617553wrc.258.1600441580973; Fri, 18 Sep 2020 08:06: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 d5sm6008343wrb.28.2020.09.18.08.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:20 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 11/15] tests/qtest/vhost-user-test: add migrate_reconnect test Message-ID: <20200918150506.286890-12-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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 , Dima Stepanov , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: 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 91f8cfda12..f8c74285c1 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); 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 == TEST_FLAGS_MIGRATE_DISCONNECT) { + qemu_chr_fe_disconnect(chr); + s->test_flags = TEST_FLAGS_BAD; + } break; case VHOST_USER_SET_VRING_BASE: @@ -737,6 +747,17 @@ static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg) return server; } +static void *vhost_user_test_setup_migrate_reconnect(GString *cmd_line, + void *arg) +{ + TestServer *server; + + server = vhost_user_test_setup_memfd(cmd_line, arg); + server->test_flags = TEST_FLAGS_MIGRATE_DISCONNECT; + + return server; +} + static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *alloc) { TestServer *server = arg; @@ -1149,5 +1170,9 @@ static void register_vhost_user_test(void) opts.before = vhost_user_test_setup_memfd; qos_add_test("migrate", "vhost-user-blk", test_migrate, &opts); + + opts.before = vhost_user_test_setup_migrate_reconnect; + qos_add_test("migrate_reconnect", "vhost-user-blk", + test_migrate, &opts); } libqos_init(register_vhost_user_test); From patchwork Fri Sep 18 15:06:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 995A9C43464 for ; Fri, 18 Sep 2020 15:19:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9925F2388B for ; Fri, 18 Sep 2020 15:19:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eYIK1SgI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9925F2388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIAz-0004yz-Mx for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:19:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyA-0006ec-RB for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHy1-0000Zd-US for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441587; 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=TPDf+xbd6OSQVu/EfDuz5JDYKXxG48Jv4mpND68W+dk=; b=eYIK1SgITYlwGjIvB4svaDMedhdfA6V2l0b28gvLvgbW8Fsyyf0sIw4Zex/HWUgRH+FalU vcoyci00vSyjsWEBWbS4+mO6+vEpg1No/bsdiRZS93BQPsLcgTeI4Nt2uARNdEfpiiwsym zi0Fx8xI8CZ/VoUpNap6r8KkuEUYk6I= 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-568-0nayQ8MTNqm4UDLQdj4rFg-1; Fri, 18 Sep 2020 11:06:25 -0400 X-MC-Unique: 0nayQ8MTNqm4UDLQdj4rFg-1 Received: by mail-wm1-f69.google.com with SMTP id m25so2173431wmi.0 for ; Fri, 18 Sep 2020 08:06:25 -0700 (PDT) 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=TPDf+xbd6OSQVu/EfDuz5JDYKXxG48Jv4mpND68W+dk=; b=HFPxO6+6Kg7aXxpODiUlJh1ph/l9MtasKmaqNhw6h6zY7JN3Xj2a8bIf3GUJpIjcVf TirnjICHlIe93Gr6+INWFhYu8v+COcZJXTwytO5dVjXlKoeNfXrHczUF/uFsduQwKqLe 5sbsG6qeF38JAevn1Nfq9+vwWyMsq+lrzn4Ug5a3xiJ93yg7fDF7BZ1n09dEv63fpdxh 5zXR7cUHg/2Pf2H8BKPX4DDzLOeWtnYeylAiG5FNkije/Fb1ivJobC4fHKTAtETviDEg /6B9M+GbSiQYT+G69ySauzLMcz/svm5iqvhtohn9ncuwEuTiHgUb7bjn25rfATfQfQsm jDMA== X-Gm-Message-State: AOAM530jlXoWZoED7F+T/dEUXb+OMXjeGCiGeUSWxnbxdcUI88rrI0Qa WaIMiQe/pI5NpS2+MFgsqZ7Yje2m39FD6CaUHMnVg3onRlmmq0lUHyLlzWSD+2RA1oKsEDWKIet toaOPNzbxu78qYeM= X-Received: by 2002:a5d:404b:: with SMTP id w11mr15845961wrp.24.1600441583850; Fri, 18 Sep 2020 08:06:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR5RK/JC+v+y/cP1WHwQC33eXCI3zHgGp7b+gvqZy0H7eM7RwD7Ah1QvqJJo1ic0mKu1c6uw== X-Received: by 2002:a5d:404b:: with SMTP id w11mr15845940wrp.24.1600441583694; Fri, 18 Sep 2020 08:06: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 a5sm5620789wrp.37.2020.09.18.08.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:23 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 12/15] tests/qtest/vhost-user-test: enable the reconnect tests Message-ID: <20200918150506.286890-13-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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: 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 f8c74285c1..d5293a4673 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -1139,20 +1139,17 @@ static void register_vhost_user_test(void) "virtio-net", test_migrate, &opts); - /* keeps failing on build-system since Aug 15 2017 */ - if (getenv("QTEST_VHOST_USER_FIXME")) { - opts.before = vhost_user_test_setup_reconnect; - qos_add_test("vhost-user/reconnect", "virtio-net", - test_reconnect, &opts); + opts.before = vhost_user_test_setup_reconnect; + qos_add_test("vhost-user/reconnect", "virtio-net", + test_reconnect, &opts); - opts.before = vhost_user_test_setup_connect_fail; - qos_add_test("vhost-user/connect-fail", "virtio-net", - test_vhost_user_started, &opts); + opts.before = vhost_user_test_setup_connect_fail; + qos_add_test("vhost-user/connect-fail", "virtio-net", + test_vhost_user_started, &opts); - opts.before = vhost_user_test_setup_flags_mismatch; - qos_add_test("vhost-user/flags-mismatch", "virtio-net", - test_vhost_user_started, &opts); - } + opts.before = vhost_user_test_setup_flags_mismatch; + qos_add_test("vhost-user/flags-mismatch", "virtio-net", + test_vhost_user_started, &opts); opts.before = vhost_user_test_setup_multiqueue; opts.edge.extra_device_opts = "mq=on"; From patchwork Fri Sep 18 15:06:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 305058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B683BC43463 for ; Fri, 18 Sep 2020 15:17:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA3A62388E for ; Fri, 18 Sep 2020 15:17:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Vaqiy2qt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA3A62388E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJI8Z-0001mM-4b for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:17:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyF-0006it-C7 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHyA-0000Zw-5k for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441591; 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=WgIXP7sDbRWyuuX+0RLdI/xrGfXKBlRaf+WuOu5biNg=; b=Vaqiy2qt9KQANte2cdShpVlI/aIAWxvUoMtHrhkE+BAZXNDUL5YAd7eFBEpxDCUnIXnpQj OVBLAOjPse8a5n5MTi74IiDY9qaN8Nm/TpVzV7pJSBowJvqbculzIX6WXQ3xFq5e7Y9en0 RqzninlZbnLyAWB27EWPhts+Zebkfuo= 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-465-v4-13JMQMgeKRrQjHUrtmA-1; Fri, 18 Sep 2020 11:06:29 -0400 X-MC-Unique: v4-13JMQMgeKRrQjHUrtmA-1 Received: by mail-wr1-f69.google.com with SMTP id f18so2234344wrv.19 for ; Fri, 18 Sep 2020 08:06:29 -0700 (PDT) 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=WgIXP7sDbRWyuuX+0RLdI/xrGfXKBlRaf+WuOu5biNg=; b=BdxgzT65J+Nr52G3E4xHixtvMGH4DlwZR4k/Sm53pltKVXNs6svSW6o7sn/5W/hw4A cAbGVvenhxt/L7GOMdmPzpQpa//SMfSwERIdgUd04/u5d379TCqGfJmf13pWrD7O7jy1 wo3FvJDpbaldJUOqPkEpTzBjrHU5etz8itNKtfJRZZ9TWnxSZT77CQSbYWGiVnuCD3/q ilI5EAsZHEvv+gNhoHQn1lz4kEiUnPYEWIHom7+ZwxmWt26GvFkekDN3bd6GivgNqcEZ gl16J64sCTS7jIZXEaEcJd/spntZ1AR63vgzN7ptAnytk98lKG+2pj0InVEzseqac5vm gC9Q== X-Gm-Message-State: AOAM531Apqn6kqy1/k9iApM2IpTLpZNqaGf4lrvuu7FNQTTcPvU03CyV SpbPZhwMG+ESOCzUhRJOlvWUvngus5RGXwcVZMyx2rWPCxR1qb8ZmxHQ95aL9b+x8QgzK9x5kEt HrzGP3Ji/r42h12k= X-Received: by 2002:adf:ec82:: with SMTP id z2mr37948919wrn.214.1600441587683; Fri, 18 Sep 2020 08:06:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy275uKF1rMFm9teMUsCRbbWC3BIW+fvcpDpaW0EcEdKwH5UPwkptQ9hc8Di5qv02OddWRkOw== X-Received: by 2002:adf:ec82:: with SMTP id z2mr37948871wrn.214.1600441587264; Fri, 18 Sep 2020 08:06:27 -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 k4sm5901477wrx.51.2020.09.18.08.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:26 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 13/15] cphp: remove deprecated cpu-add command(s) Message-ID: <20200918150506.286890-14-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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=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: Laurent Vivier , Peter Maydell , Thomas Huth , Eduardo Habkost , David Hildenbrand , libvir-list@redhat.com, Michal Privoznik , Cornelia Huck , "Dr . David Alan Gilbert" , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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' ] } -## -# @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 **errp); int (*kvm_type)(MachineState *machine, const char *arg); void (*smp_parse)(MachineState *ms, QemuOpts *opts); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 421a77acc2..79b7ab17bc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -135,7 +135,6 @@ extern int fd_bootchk; void pc_acpi_smi_interrupt(void *opaque, int irq, int level); -void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp); void pc_smp_parse(MachineState *ms, QemuOpts *opts); 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); } -void hmp_cpu_add(Monitor *mon, const QDict *qdict) -{ - int cpuid; - Error *err = NULL; - - error_report("cpu_add is deprecated, please use device_add instead"); - - cpuid = 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 = 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); } -void qmp_cpu_add(int64_t id, Error **errp) -{ - MachineClass *mc; - - mc = 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 d11daacc23..d071da787b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -777,32 +777,6 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts) } } -void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp) -{ - X86MachineState *x86ms = X86_MACHINE(ms); - int64_t apic_id = x86_cpu_apic_id_from_index(x86ms, id); - Error *local_err = NULL; - - if (id < 0) { - error_setg(errp, "Invalid CPU id: %" PRIi64, id); - return; - } - - if (apic_id >= 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 rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count) { if (cpus_count > 0xff) { @@ -1966,7 +1940,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) mc->auto_enable_numa_with_memdev = true; mc->has_hotpluggable_cpus = true; mc->default_boot_order = "cad"; - mc->hot_add_cpu = pc_hot_add_cpu; mc->smp_parse = pc_smp_parse; mc->block_default_type = IF_IDE; mc->max_cpus = 255; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 33fa035fb7..8ce7dda464 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 = "1.4.0"; - m->hot_add_cpu = NULL; compat_props_add(m->compat_props, pc_compat_1_4, pc_compat_1_4_len); } 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(MachineState *machine, return NULL; } -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 = 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 = qemu_get_cpu(cpu_index); @@ -604,7 +593,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->hpage_1m_allowed = true; mc->init = ccw_init; mc->reset = s390_machine_reset; - mc->hot_add_cpu = s390_hot_add_cpu; mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->no_floppy = 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; -static void test_plug_with_cpu_add(gconstpointer data) -{ - const PlugTestData *s = data; - char *args; - QDict *response; - unsigned int i; - - args = g_strdup_printf("-machine %s -cpu %s " - "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u", - s->machine, s->cpu_model, - s->sockets, s->cores, s->threads, s->maxcpus); - qtest_start(args); - - for (i = 1; i < s->maxcpus; i++) { - response = 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 = data; - char *args; - QDict *response; - - args = g_strdup_printf("-machine %s -cpu %s " - "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u", - s->machine, s->cpu_model, - s->sockets, s->cores, s->threads, s->maxcpus); - qtest_start(args); - - response = 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 = data; @@ -144,36 +96,13 @@ static void add_pc_test_case(const char *mname) data->cores = 3; data->threads = 2; data->maxcpus = data->sockets * data->cores * data->threads; - if (g_str_has_suffix(mname, "-1.4") || - (strcmp(mname, "pc-1.3") == 0) || - (strcmp(mname, "pc-1.2") == 0) || - (strcmp(mname, "pc-1.1") == 0) || - (strcmp(mname, "pc-1.0") == 0)) { - path = g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=%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 = g_memdup(data, sizeof(PlugTestData)); - data2->machine = g_strdup(data->machine); - data2->device_model = g_strdup(data->device_model); - - path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%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 = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%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 = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%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); } 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; 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 = 1; data->maxcpus = data->sockets * data->cores * data->threads; - data2 = g_memdup(data, sizeof(PlugTestData)); - data2->machine = g_strdup(data->machine); - data2->device_model = g_strdup(data->device_model); - - path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u", + path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%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 = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%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[] = { "chardev-change testchardev1 ringbuf", "chardev-remove testchardev1", "commit all", - "cpu-add 1", "cpu 0", "device_add ?", "device_add usb-mouse,id=mouse1", 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. -``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) '''''''''''''''''''''''''''' @@ -306,12 +299,6 @@ the 'wait' field, which is only applicable to sockets in server mode Human Monitor Protocol (HMP) commands ------------------------------------- -``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) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' @@ -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. +``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 ------------------------------------- @@ -538,6 +531,12 @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_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``. +``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 ------------------- 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 - { - .name = "cpu-add", - .args_type = "id:i", - .params = "id", - .help = "add cpu (deprecated, use device_add instead)", - .cmd = 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 = "qom-list", .args_type = "path:s?", From patchwork Fri Sep 18 15:06:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A1AC43463 for ; Fri, 18 Sep 2020 15:22:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 525B420717 for ; Fri, 18 Sep 2020 15:22:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V84BjClw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 525B420717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIDN-0007uT-0B for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyE-0006ha-OU for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:42 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:48454 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 1kJHyB-0000ad-A5 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441595; 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=V84BjClwIKoWxfqmHCzApMTK/PNH8tGco+o/qSFFjnfNu7usZha3RmZK2ZXd2Va3RYqgJm c0cprTm7ObPPffynU0d1nasnm5ydtrRiQBsJd/sOdqzG9HnPqYTgaiSq65VBtGrOw0w60t evn/Z3jo4nd8fTbGiCJ6uMqvy07aLpY= 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-532-E5QERX7POce9EsqCi2Tsxg-1; Fri, 18 Sep 2020 11:06:31 -0400 X-MC-Unique: E5QERX7POce9EsqCi2Tsxg-1 Received: by mail-wr1-f71.google.com with SMTP id l17so2223878wrw.11 for ; Fri, 18 Sep 2020 08:06:31 -0700 (PDT) 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=iBUPt19sWSZBkvR5otCLNmrkLN+MoJUSgR5CSn4QLYHs6z4WKIaBL/ISFGtIrDqB+m St3YB5Gf0ehVLDm6AOsRRzbx/Fq2tnJuxOAjs2SFM+9qIeD3B+q/PY2q1NUbjSHzkvkw jO3HW+oBPgYMEvZqn2VWCliiRsAgTCA+VKh+jK1VItTWGO9YhY8bCEWJG+KQ8k29AKn+ ZPfLuhgBF7HMrk6nau8KFfllQlvPXDUddj9NMdovDec7W3ULEoalZIDOh6xp3bAAf7dD 6GJFKf8pvkHhj9CWd7LX+c2Y1/VLPTB7NBe1bZXWgnRdGlPypiUpNniUqQZLkZ32tkI6 ktvg== X-Gm-Message-State: AOAM533okZIK7QdWJuGjcu3D+/x0SyRAzQRTCwwrGo/uGCXSjQxm0a6p XKEzCDBjYIQPbMVVsBkIjnYnGKh8nnnIRGCtDAmlIq6trr7zTB/QQj+osJTOJlaovSSkME0LbnD xGI0HdZxnRLewrxE= X-Received: by 2002:a1c:2903:: with SMTP id p3mr16595717wmp.170.1600441589900; Fri, 18 Sep 2020 08:06:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZCfnAAg0F9H8+BrH+z/wQZfqer4MnVwx4mMwzKqT9Q0DEsN8e9M5/qSzXic4ish5EufM7Pw== X-Received: by 2002:a1c:2903:: with SMTP id p3mr16595700wmp.170.1600441589729; Fri, 18 Sep 2020 08:06: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 t203sm5866140wmg.43.2020.09.18.08.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:29 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 14/15] virtio-iommu: Check gtrees are non null before destroying them Message-ID: <20200918150506.286890-15-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger If realize fails, domains and endpoints trees may be NULL. On unrealize(), this produces assertions: "GLib: g_tree_destroy: assertion 'tree != 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 = VIRTIO_IOMMU(dev); 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); + } virtio_delete_queue(s->req_vq); virtio_delete_queue(s->event_vq); From patchwork Fri Sep 18 15:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 273390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 588FBC43464 for ; Fri, 18 Sep 2020 15:23:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9B7C2388B for ; Fri, 18 Sep 2020 15:23:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NeZVnsIr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9B7C2388B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIEE-00005t-Mr for qemu-devel@archiver.kernel.org; Fri, 18 Sep 2020 11:23:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJHyD-0006fv-Dl for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51484) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJHyA-0000ah-NI for qemu-devel@nongnu.org; Fri, 18 Sep 2020 11:06:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600441596; 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=NeZVnsIrpnP/XQWRYJ1xHWrZXKpZH+so6cYyMl2fZ+1txseg1Wo3gsDVcKjS+CKR7O/u+2 Tb1OBaoP11LSn3dFN6HFfU+qwrgCkELxEHmsaPj88kXJpUIGC3A3Uct/4gxGzkrh2sg4Ie WA0A7OCGp12WCpX5yyTii3KqpJqlWIw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-38-bm7ZJQf7POyMs3VSJQNITQ-1; Fri, 18 Sep 2020 11:06:34 -0400 X-MC-Unique: bm7ZJQf7POyMs3VSJQNITQ-1 Received: by mail-wm1-f71.google.com with SMTP id a7so2171438wmc.2 for ; Fri, 18 Sep 2020 08:06:33 -0700 (PDT) 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=rlyvz7IMz3zcCRXBTOO+eANg0IEIRycBWwEkH8ilIzDvEsCxJh/TivzB30TX5mkCRt Dap6ay7BPS8FWn9y6M3hnVQYl3/3kDV7oorVzemiAcGprCGrcNiautnAzVioYhiDOBZm sdD7dpcaCwoZU0TTwSefYl3cLg0O3RNacy4diqu5MPzEGPMrOGhU4tguajaIp/p8D5fI TpuHSxIc27ixb4TbdhFctm6KHH8g5O48U0+vSLNMuvTBA+UpxEkK/cQKJas8gBvoTV2K NKSYy31VBR25tS+9nHi9dVGUdrPXnhFiXkTEgDnb5LOwbKo/u/EA3u4OWk7/x1kPhhu8 4A7w== X-Gm-Message-State: AOAM530fHkUrRlg1ed8bAxAZainGSru3edxwWKV/yk0ETRewiCv2pjbN 2rspDyeBJJJwFpuTJaiuP0D5KYLlsinSdKa2ZTn1IainySnp0hOcnzMj+25EMPGlodn3YzHEZj6 d3SKDprWFO/9Lw/0= X-Received: by 2002:a1c:c2c6:: with SMTP id s189mr16051077wmf.146.1600441592404; Fri, 18 Sep 2020 08:06:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAEOS/BBEWrJMYQOiz2DkCRKhUo5RxBL81EK1YAj3GfFxLw58Rgfxlr9Xapd149ErFZQ6SJw== X-Received: by 2002:a1c:c2c6:: with SMTP id s189mr16051058wmf.146.1600441592234; Fri, 18 Sep 2020 08:06: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 i16sm5638753wrq.73.2020.09.18.08.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:06:31 -0700 (PDT) Date: Fri, 18 Sep 2020 11:06:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 15/15] virtio-iommu-pci: force virtio version 1 Message-ID: <20200918150506.286890-16-mst@redhat.com> References: <20200918150506.286890-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200918150506.286890-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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=on' on virtio-iommu-pci: qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=on 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=on' 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); } @@ -98,7 +99,6 @@ static void virtio_iommu_pci_instance_init(Object *obj) static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .base_name = TYPE_VIRTIO_IOMMU_PCI, .generic_name = "virtio-iommu-pci", - .transitional_name = "virtio-iommu-pci-transitional", .non_transitional_name = "virtio-iommu-pci-non-transitional", .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init,