From patchwork Tue Apr 11 06:48:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 81768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2373184vqo; Mon, 10 Apr 2023 23:55:03 -0700 (PDT) X-Google-Smtp-Source: AKy350ZUf6dhYT2g+mGsiA+UaIDAQ6DTS3UlPv4yQe8Qo7IZcycXMuUU6H8lFaWkXK+qWPSpm8yn X-Received: by 2002:a05:6402:31e3:b0:504:8c65:d277 with SMTP id dy3-20020a05640231e300b005048c65d277mr7808571edb.19.1681196103587; Mon, 10 Apr 2023 23:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681196103; cv=none; d=google.com; s=arc-20160816; b=FbbMC0a0hKu6eV1/hNA5jSg7oxZPUeKFyhNpTi1iDHmID7QWWNSm0h9/wV84VZ+w+s 9H+CTm03csjdY9O3J7JGt7DWiBExl3KxRRVDID2ol8mCUs1oKjMiRe2QAlVpbx/8LWNC Scz4miuaI2f0gzNQqpCvDleVbTXmqs2LxVPLmuzmPYTeJKb+59gwUeMsZaBYr/c1+HwF 7P4b3bSmVIDZKnqxHMPTOzniOkFkILLo3Zne+pDJ61lYgmhvjvUbVSiXr06lmDlcgeYs 8o8GLRLpV3tzU5R9TvDvZOPNaGsFERGnUbmCgJIlrTw3JwC0UClI8py26Cezd7SZEsNV 0uyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3rgJUuhznbz7+IKrs6uwZfwZ9X3MmjI0xiAcLTwmTw0=; b=QF81Z16oT6Dj7HmLJRn0jp05UcGINp60ATYMiV+Y6T5EzUP/jwWebV5gzXhi8YT3i6 qhHeCtC2UYvbrCuHreoh6InknZI2+qVSvFL3A5azLd+uZtXXuxhreD+T+HNSKeOYaRaT 69ElqE7eKgxxI8BLxGS2hX6Rwjm/WPfod4MUzVLkeXKB6l7zM3pLRpNnzLxWiWCpc/3z vzQsFmu5N+8EekUVDSmua4E+EDd/KAD4cd5R+ccUCte99BRzdOH9v8/S52Us78zNbkpv 7vDWEV60L7vv4DEZ3y5g6ah/7hFBg2xwlnmZdEilEWJuFQCBZ2izTF20A467LjKt305l 7iDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwVhYuC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a056402020200b005049b7f3dcasi4571739edv.661.2023.04.10.23.54.39; Mon, 10 Apr 2023 23:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwVhYuC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjDKGuj (ORCPT + 99 others); Tue, 11 Apr 2023 02:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjDKGuR (ORCPT ); Tue, 11 Apr 2023 02:50:17 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB7E423F for ; Mon, 10 Apr 2023 23:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681195784; x=1712731784; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fHc/Dt3WZSFDnH//DR0PtW4o8sOEHZYZ41tbx+9UmIU=; b=dwVhYuC2L1KsP/sTK63g3tc+rivKc/wENqYW8HWayZq2XZqNBc1r0RFe TYmd8gUEfEB7fR3S3nBuCfXv4cbcDZDyAeHUQJjIpjzHMQBQW4mv5/B5v P8VlcFxG/ymsuzAT96l7eIEujR+56Vrkm2/a6rcyKdKUIfcGZ1zU/rbIt T3kzz1pHBTOf9TguFoozkGjqdeLiRrpIdDdFmucQd7TWUwQnsdU1X146J oCQI4RX/bMUPEs245jCbxTAmElITh2wL/L5e/lamg8leiLXJ/R0dwTYnT KGPhSZIRohnIJzaGrvU+hQ7TfH+GesVjYHivmpTYNeOZdyi2AaUpXolmG A==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="341028600" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="341028600" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2023 23:48:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="1018256620" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="1018256620" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 10 Apr 2023 23:48:33 -0700 From: Lu Baolu To: Joerg Roedel Cc: Vinod Koul , Tina Zhang , Jacob Pan , Christophe JAILLET , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 11/17] iommu/vt-d: Fix operand size in bitwise operation Date: Tue, 11 Apr 2023 14:48:09 +0800 Message-Id: <20230411064815.31456-12-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411064815.31456-1-baolu.lu@linux.intel.com> References: <20230411064815.31456-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762861885541159703?= X-GMAIL-MSGID: =?utf-8?q?1762861885541159703?= From: Tina Zhang The patch fixes the klocwork issues that operands in a bitwise operation have different size at line 1692 of dmar.c, line 1898 and line 1907 of iommu.c. Reported-by: Yongwei Ma Signed-off-by: Tina Zhang Link: https://lore.kernel.org/r/20230406065944.2773296-2-tina.zhang@intel.com Signed-off-by: Lu Baolu Signed-off-by: Tina Zhang --- drivers/iommu/intel/dmar.c | 2 +- drivers/iommu/intel/iommu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 23828d189c2a..f0f51c957ccb 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -1690,7 +1690,7 @@ static void __dmar_enable_qi(struct intel_iommu *iommu) * is present. */ if (ecap_smts(iommu->ecap)) - val |= (1 << 11) | 1; + val |= BIT_ULL(11) | BIT_ULL(0); raw_spin_lock_irqsave(&iommu->register_lock, flags); diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index f4e536fd5a28..acbf82fa90e7 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1870,7 +1870,7 @@ context_set_sm_rid2pasid(struct context_entry *context, unsigned long pasid) */ static inline void context_set_sm_dte(struct context_entry *context) { - context->lo |= (1 << 2); + context->lo |= BIT_ULL(2); } /* @@ -1879,7 +1879,7 @@ static inline void context_set_sm_dte(struct context_entry *context) */ static inline void context_set_sm_pre(struct context_entry *context) { - context->lo |= (1 << 4); + context->lo |= BIT_ULL(4); } /* Convert value to context PASID directory size field coding. */