Commit Graph

1223776 Commits

Author SHA1 Message Date
chinaljp030 7722165753
!143 [next-6.6] kunpeng:Backport some bugfixes for hisi_sas
Merge pull request !143 from chenyi/linux-6.6/next-cy-dev
2024-05-08 06:39:25 +00:00
刘诗 b294718c76
!149 [next-6.6]Hygon:Update ccp-crypto driver to support Hygon 4th CPU & add hct.ko module which needed by HCT engine
Merge pull request !149 from partyCoder/next
2024-05-07 06:36:14 +00:00
Yabin Li c77b21d787 Commit Message: Support 1024 processes simutaneously in the hct-mdev mode.
Signed-off-by: Yabin Li <liyabin@hygon.cn>
Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-05-07 09:54:36 +08:00
Yabin Li 0dfa39df10 Commit Message: Change the maximum number of supported ccps from 16 to 48.
Signed-off-by: Yabin Li <liyabin@hygon.cn>
Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-05-07 09:54:36 +08:00
Yabin Li 8dfdf88cb9 Commit Message: Compiling hct.ko when the module mdev is disabled.
Signed-off-by: Yabin Li <liyabin@hygon.cn>
Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-05-07 09:54:36 +08:00
Yabin Li f0872dfb71 ccp: supporting memory encryption features for host vfio-noiommu mode, and wb attribute for the bar memory of virtual machine.
Signed-off-by: Yabin Li <liyabin@hygon.cn>
Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-05-07 09:54:36 +08:00
Yabin Li 346dc8c7ca Add mediated ccp driver support for hygon crypto technology.
Signed-off-by: Yabin Li <liyabin@hygon.cn>
Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-05-07 09:54:31 +08:00
刘诗 956b826d8e
!148 [next-6.6]Hygon:Support CSV(2) guest attestation, CSV firmware update, CSV(2) guest migration, CSV(2) guest reboot, x86-psp communicate interfaces
Merge pull request !148 from hanliyang/next
2024-05-06 07:40:03 +00:00
hanliyang 2fb5abf978 KVM: SVM: Force flush caches before reboot CSV guest
Upstream: no

For memory encrypted guest, its pages' encrypt status will changed at
runtime. When user reboot the guest, the pages' encrypt status during
last boot were ignored. So during the boot flow of reboot, there may
be 2 versions of memory data lies in cache as follows:

                  +--------+        |              |
                  |        |        +--------------+  --+
                  |        |        |              |     \
                  |________|        |              |      \
cacheline for  -> |________| <-+    |              |       \
 pa1(c=0)         |        |    \   |______________|        \
                  |        |     \_ 64 bytes aligned <- pa1  \
                  |        |      _ |______________|           4K
                  |        |     /  |              |           page
cacheline for     |________|    /   |              |         /
 pa1(c=1)      -> |________| <-+    |              |        /
                  |        |        |              |       /
                  |        |        |              |      /
                  |        |        |              |     /
                  |        |        +--------------+  --+
                  |        |        |              |

If the older version cache was flushed after that of newer version, and
guest read the memory again, then it will get corrupted data and may
lead to crash.

In this change, for any memory encrypted guest, the cache is forcibly
flushed to memory before the next boot flow, which ensures that memory
access is up-to-date.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-05-06 11:39:20 +08:00
hanliyang c6d3aa44b4 KVM: SVM: Add support for rebooting CSV2 guest
Upstream: no

Currently, reboot a CSV2 guest is unsupported because vCPU state is
encrypted and can't be initialized when guest reboots to execute
OVMF code.

In order to support reboot a CSV2 guest, make a backup of the
encrypted VMSA before booting the guest, and restore VMSA from the
backup before rebooting the guest.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-05-06 11:39:16 +08:00
hanliyang a717c0e01d KVM: x86: Introduce control_{pre,post}_system_reset ioctl interfaces
Upstream: no

In the upcoming patches, we will support for rebooting CSV2 guests. In
order to support rebooting CSV2 guest, we will set
vcpu->arch.guest_state_protected to false, before VMRUN, so that VMM
can initialize vCPU states and VMSA, and then set
vcpu->arch.guest_state_protected back to true to bypass unexpected
behaviour in KVM. Besides, cache flush is necessary during rebooting a
memory encrypted guest.

Introduce control_{pre,post}_system_reset ioctl interfaces to support
rebooting memory encrypted guests correctly.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-05-06 11:39:12 +08:00
hanliyang 0d648c30f0 KVM: SVM: Export MSR_AMD64_SEV_ES_GHCB to userspace for CSV2 guest
Upstream: no

VMCB.control.ghcb_gpa contains necessary info to support runtime CSV2
guest. At present, it includes the following points:

    1. For GHCB MSR protocol, ghcb_gpa stores the negotiation result
    2. For GHCB page protocol, ghcb_gpa stores the GPA of GHCB page

In addition, AP VCPU's SIPI state and GHCB page mapping state are
temporarily stored in KVM.

When CSV2 guest was migrated to the recipient, KVM needs to restore
VMCB.control.ghcb_gpa, VCPU's SIPI state and GHCB page mapping state on
the source side.

This patch is to support export MSR_AMD64_SEV_ES_GHCB to userspace. KVM
can collect all the infos dictated above and return to userspace if
userspace request to get MSR_AMD64_SEV_ES_GHCB, and KVM can restore all
the infos dictated above if userspace request to set
MSR_AMD64_SEV_ES_GHCB.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-05-06 11:39:08 +08:00
hanliyang b75a26008d KVM: x86: Restore control registers in __set_sregs() to support CSV2 guest live migration
Upstream: no

When migrate CSV2 guest to the recipient, the KVM which on
recipient's side needs to update the guest context so that the guest
can continues to run. The control register state is necessary for
updating the guest context.

Allows the control registers to be updated in __set_sregs() so that
the CSV2 guest could continue running correctly after migrated to
the recipient.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-05-06 11:38:50 +08:00
yangdepei 861bd616fb ccp: ccp-crypto support sm2 on Hygon generation 4th CPU
Upstream: no

1. support sm2 on 4th cpu
2. create new ccp-dev-v5.c file for hygon ccp only
3. restore original ccp-dev-v5.c file

Signed-off-by: yangdepei <yangdepei@hygon.cn>
2024-04-30 17:22:59 +08:00
hanliyang 446873bf7b KVM: SVM: Add KVM_SEV_RECEIVE_UPDATE_VMSA command
Upstream: no

The command is used for copying the incoming buffer into the VMSA
memory regions of CSV2 guest.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:17 +08:00
hanliyang 4b57b79676 KVM: SVM: Add KVM_SEV_SEND_UPDATE_VMSA command
Upstream: no

The command is used for encrypting the VCPU register states of CSV2
guest using the encryption context created with KVM_SEV_SEND_START.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:17 +08:00
hanliyang 197d3828b5 crypto: ccp: Fix definition of struct sev_data_send_update_vmsa
Upstream: no

The current definition of struct sev_data_send_update_vmsa in
include/linux/psp-sev.h does not comply with SEV API spec.

Fix it here.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:17 +08:00
chench 88a4c829d3 crypto: ccp: Add another mailbox interrupt support for PSP sending command to X86
Upstream: no

The existing kernel supports only interrupt for the mailbox interface
for X86 sending commands to PSP and PSP to ack, e.g. the SEV commands.
However, some PSP-based security modules in Hygon CPU, such as TPCM
and TDM(Trusted Dynamic Measuring), needs sending
commands/notifications proactively to X86 core via interrupt and a 2nd
mailbox interface. Similar to the existing one, the 2nd mailbox
consists of a 32-bits command register and two 32-bits data registers.

The PSP interrupt handling needs to add this interrupt support;
besides, in order to support user defined command handler, a callback
registration function is also provided. Up to 16 command callbacks is
supported, which are indexed by command IDs. Currently, command ID 0
is assigned to TPCM and 1 to TDM, while others are reserved.

Currently, Hygon PSP does not support bootloader info reg, remove
the value of bootloader_info_reg.

Signed-off-by: chench <chench@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:17 +08:00
chench f94ca9e54f crypto: ccp: Add a new interface for X86 sending command to PSP
Upstream: no

HYGON's fTPM and TDM need to send commands to PSP to complete the
firmware function.

In order to be compatible with the original kernel code, The command
of psp_do_cmd is added to send the command from x86 to PSP. The
interface is currently used for fTPM/TDM/TPCM of HYGON.

Signed-off-by: chench <chench@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:17 +08:00
fangbaoshun e7557f449f KVM: SVM: Add RECEIVE_UPDATE_DATA command helper to support KVM_CSV_COMMAND_BATCH
Upstream: no

When KVM_CSV_COMMAND_BATCH handling a batch of RECEIVE_UPDATE_DATA
commands, it need execute 2 steps:

    1. Enqueue each SEND_UPDATE_DATA command data to CSV RING_BUFFER
       queues (as input of RING_BUFFER command)
    2. Issue RING_BUFFER command

In this change, we add sev_receive_update_data_to_ringbuf() to
prepare input required by RING_BUFFER command as dictated in step 1.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:16 +08:00
fangbaoshun e30ba16f68 KVM: SVM: Add SEND_UPDATE_DATA command helper to support KVM_CSV_COMMAND_BATCH
Upstream: no

When KVM_CSV_COMMAND_BATCH handling a batch of SEND_UPDATE_DATA
commands, it need execute 3 steps:

    1. Enqueue each SEND_UPDATE_DATA command data to CSV RING_BUFFER
       queues (as input of RING_BUFFER command)
    2. Issue RING_BUFFER command
    3. Copy the output of RING_BUFFER command to userspace

In this change, we add sev_send_update_data_to_ringbuf() to prepare
input required by RING_BUFFER command as dictated in step 1, and
add sev_send_update_data_copy_to_user() to copy output userspace as
dictated in step 3.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:16 +08:00
fangbaoshun f5b7f02683 KVM: SVM: Prepare memory pool to allocate buffers for KVM_CSV_COMMAND_BATCH
Upstream: no

In the upcoming patches, many buffers need to be allocated in
KVM_CSV_COMMAND_BATCH code paths. To avoid memory allocation
failures, directly allocate a memory pool in sev_hardware_setup()
and free the memory pool in sev_hardware_teardown().

When KVM_CSV_COMMAND_BATCH handling a batch of
SEND_UPDATE_DATA/RECEIVE_UPDATE_DATA commands, it will allocate
trans buffers from the memory pool.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:16 +08:00
fangbaoshun a4c35f66c7 KVM: SVM: Add KVM_CSV_COMMAND_BATCH command for applying CSV RING_BUFFER mode
Upstream: no

The API KVM_CSV_COMMAD_BATCH receives data of structure
kvm_csv_command_batch which embedded a link list of CSV command
requests from userspace. It will do some preparation works to ensure
data available for CSV RING_BUFFER mode, and then issues
RING_BUFFER command.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:40:16 +08:00
fangbaoshun 01938abc93 crypto: ccp: Add support for issue commands in CSV RING_BUFFER mode
Upstream: no

The CSV firmware stays in Mailbox mode by default. Upon successfully
switched to CSV RING_BUFFER mode, the semantics of the 3 registers
used for communicate between X86 and CSV firmware will be changed:

    - The CmdResp register becomes the RBCtl register. It is only
      ever written by X86.
    - The CmdBufAddr_Hi register becomes the RBTail register. It
      is only ever written by X86.
    - The CmdBufAddr_Lo register becomes the RBHead register. It
      should never be written by X86; the PSP will update it.

The CSV firmware will exit CSV RING_BUFFER mode when it read invalid
value from the RBCtl register.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:39:47 +08:00
fangbaoshun bc31f5e8c7 crypto: ccp: Add support to switch to CSV RING_BUFFER mode
Upstream: no

Invoke RING_BUFFER command will switch CSV firmware to RING_BUFFER
mode. When CSV firmware stays in RING_BUFFER mode, it will fetch
commands from CSV RING_BUFFER queues which are filled by X86.

The CSV firmware will exit RING_BUFFER mode after SHUTDOWN command
is completed.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 20:33:34 +08:00
fangbaoshun 218f6fdef1 crypto: ccp: Add support for dequeue status in CSV RING_BUFFER mode
Upstream: no

In CSV RING_BUFFER mode, X86 will dequeue status entries written by
PSP after the corresponding command has been handled.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:42:28 +08:00
fangbaoshun 5cc9fbb3d5 crypto: ccp: Add support for enqueue command pointers in CSV RING_BUFFER mode
Upstream: no

In CSV RING_BUFFER mode, X86 will enqueue command pointers to the sub-queue
which stores the command pointers. The priority will be given through
parameter.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:42:09 +08:00
fangbaoshun deadccdff4 crypto: ccp: Introduce init and free helpers to manage CSV RING_BUFFER queues
Upstream: no

There are up to two queues created in RING_BUFFER mode, each with two
sub-queues. The sub-queues store the command pointer entries (written
only by the x86) and status entries (written only by the CSV Firmware)
respectively. The two queues are low priority queue (required) and
high priority queue (optional) respectively.

In this change, we introduce csv_ring_buffer_queue_init() to
initialize CSV RING_BUFFER queues, and csv_ring_buffer_queue_free()
to cleanup CSV RING_BUFFER queues.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:41:44 +08:00
hanliyang a90e977db1 crypto: ccp: Implement CSV_DOWNLOAD_FIRMWARE ioctl command
Upstream: no

The CSV_DOWNLOAD_FIRMWARE command can be used by the platform owner to
updating CSV firmware.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:38:59 +08:00
hanliyang 80d64fa795 crypto: ccp: Implement CSV_PLATFORM_SHUTDOWN ioctl command
Upstream: no

The CSV_PLATFORM_SHUTDOWN command can be used by the platform owner to
switch platform to PSTATE.UNINIT.

The DOWNLOAD_FIRMWARE API can only performed when platform is in the
PSTATE.UNINIT. In order to support DOWNLOAD_FIRMWARE at userspace, we
need invoke PLATFORM_SHUTDOWN before that.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:38:28 +08:00
hanliyang 781db50331 crypto: ccp: Implement CSV_PLATFORM_INIT ioctl command
Upstream: no

The CSV_PLATFORM_INIT command can be used by the platform owner to
switch platform from PSTATE.UNINIT to PSTATE.INIT.

In the upcoming patches, we'll support DOWNLOAD_FIRMWARE at userspace.
Due to DOWNLOAD_FIRMWARE can only performed when platform is in the
PSTATE.UNINIT, we need invoke PLATFORM_INIT following DOWNLOAD_FIRMWARE
to switch platform back to PSTATE.INIT.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:38:00 +08:00
hanliyang ad47f941cd crypto: ccp: Support DOWNLOAD_FIRMWARE when detect CSV
Upstream: no

When ccp driver detect CSV support on Hygon CPU, it should try to
update the latest CSV firmware on the system paths.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:37:19 +08:00
fangbaoshun 431711de35 driver/virt/coco: Add HYGON CSV Guest dirver.
Upstream: no

CSV firmware provides the guest a mechanism to communicate with
the PSP without risk from a malicious hypervisor who wishes to read,
alter, drop or replay the messages sent. The driver provides
userspace interface to communicate with the PSP to request the
attestation report and more.

Signed-off-by: fangbaoshun <fangbaoshun@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:34:50 +08:00
hanliyang fe2fcb68d5 KVM: x86: Support VM_ATTESTATION hypercall
Upstream: no

When sev guest wants to collect the attestation report, it cannot directly
communicate with psp. Add VM_ATTESTATION hypercall to allow sev guest to
tell host to help get the attestation report. Since sev guest memory is
encrypted, host cannot tamper with the report data.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-29 15:31:48 +08:00
刘诗 45b5b15bb9
!147 [next-6.6] Montage:add support for Montage Mont-TSSE Driver
Merge pull request !147 from carrie.cai/next
2024-04-29 06:49:21 +00:00
刘诗 4e6dcf1865
!144 [next-6.6]Support PSP identification for Hygon 4th CPU and print secure features when running on Hygon CPUs
Merge pull request !144 from hanliyang/next_ident-hygon-cc-all-others
2024-04-29 06:48:32 +00:00
Carrie.Cai 2ed507edd8 add support for Montage Mont-TSSE driver
Signed-off-by: Carrie.Cai <carrie.cai@montage-tech.com>
2024-04-29 11:07:17 +08:00
hanliyang 682dcf502d x86/config: Set CONFIG_HYGON_CSV by default
Upstream: no

Configure CONFIG_HYGON_CSV=y so that Hygon Confidential Computing
support will be compiled.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 17:58:58 +08:00
hanliyang ae73c14f82 x86/cpu/hygon: Clear SME feature flag when not in use
Upstream: no

The commit 08f253ec37 ("x86/cpu: Clear SME feature flag when not in
use") will clear SME feature flag if the kernel is not using it on AMD
CPUs, this will help userspace to determine if SME is available and in
use from /proc/cpuinfo.

Apply this change to Hygon CPUs as well.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 17:27:33 +08:00
hanliyang fa5354c665 x86/cpufeatures: Add CSV3 CPU feature
Upstream: no

Add CPU feature detection for Hygon 3rd CSV. This feature enhances
CSV2 by also isolating NPT and VMCB, making them in-accessible to
the hypervisor.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 17:26:33 +08:00
hanliyang 90ab474479 x86/cpufeatures: Add CPUID_8C86_0000_EDX CPUID leaf
Upstream: no

This is a pure feature bits leaf. Add SM3 and SM4 feature bits from
this leaf on Hygon CPUs.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 17:25:27 +08:00
hanliyang 0787b3b2c6 x86/cpu: Detect memory encryption features on Hygon CPUs
Upstream: no

Hygon SME is identified by CPUID 0x8000001f, but requires BIOS support
to enable it (set bit 23 of MSR_AMD64_SYSCFG). Hygon CSV and CSV2 are
identified by CPUID 0x8000001f, but requires BIOS support to enable it
(set bit 23 of MSR_AMD64_SYSCFG and set bit 0 of MSR_K7_HWCR). Only show
the SME, CSV, CSV2 features as available if reported by CPUID and
enabled by BIOS.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 15:02:26 +08:00
hanliyang 65d57d6c0b KVM: SVM: Print Hygon CSV support info if support is detected
Upstream: no

The KVM will print 'SEV supported' instead of 'CSV supported' on Hygon
CPU if CSV is supported. Fix these confused messages here.

Fix other 'SEV' messages in arch/x86/kvm/svm/svm.c.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:58:10 +08:00
hanliyang 09b3268eec crypto: ccp: Print Hygon CSV API version when CSV support is detected
Upstream: no

The Cryptographic Co-Processor module will print 'SEV API' instead of
'CSV API' on Hygon CPU if CSV is supported. Fix this confused message
here.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:42:35 +08:00
hanliyang 3ad2c03250 x86/mm: Print CSV info into the kernel log
Upstream: no

Add CSV and CSV2 to the list of memory encryption features. Also
print CPU vendor while printing CSV infos.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:40:28 +08:00
hanliyang b1fa7a657a x86/mm: Provide a Kconfig entry to build the HYGON memory encryption support into the kernel
Upstream: no

Provide CONFIG_HYGON_CSV to the arch/x86/Kconfig, and build HYGON's
specific memory encryption support into the kernel when
CONFIG_HYGON_CSV=y.

Besides, add arch/x86/include/asm/processor-hygon.h to contains
helpers to determine the Hygon CPUs so that we can call functions
specific to CSV in the native code and reduce code intruision.

Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:37:07 +08:00
Xin Jiang 4b0b3d0e31 Documentation/arch/x86: Add HYGON secure virtualization description
Upstream: no

Add the HYGON secure virtualization document describing the secure
virtualization features.

Signed-off-by: Xin Jiang <jiangxin@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:34:48 +08:00
Xin Jiang 84410eae73 crypto: ccp: Add support to detect CCP devices on Hygon 4th CPUs
Upstream: no

Since Hygon 4th CPUs, there are new Secure Processor devices with 3
different PCI device IDs, add them in the device list.

Signed-off-by: Xin Jiang <jiangxin@hygon.cn>
Signed-off-by: hanliyang <hanliyang@hygon.cn>
2024-04-25 14:22:09 +08:00
Yihang Li 6b2bfc75b6 scsi: hisi_sas: Modify the deadline for ata_wait_after_reset()
driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96KNQ
CVE: NA

----------------------------------------------------------------------

We found that the second parameter of function ata_wait_after_reset() is
incorrectly used. We call smp_ata_check_ready_type() to poll the device
type until the 30s timeout, so the correct deadline should be (jiffies +
30000).

Fixes: 3c2673a09c ("scsi: hisi_sas: Fix SATA devices missing issue during I_T nexus reset")
Signed-off-by: xiabing <xiabing12@h-partners.com>
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Bing Xia <xiabing12@h-partners.com>
Signed-off-by: chenyi <chenyi211@huawei.com>
2024-04-24 22:16:20 -04:00
Xiang Chen 391f2b4c72 scsi: hisi_sas: Remove hisi_hba->timer for v3 hw
mainline inclusion
from mainline-v6.9-rc1
commit f9242f166770b681d9f71341d96adc01c4da00ef
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96KNQ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f9242f166770b681d9f71341d96adc01c4da00ef

----------------------------------------------------------------------

hisi_hba->timer is not used for v3 hw but there are two places that some
operations related to hisi_hba->timer are called by v3 hw:

 - Deleting the timer in function hisi_sas_v3_hw() which is only for v3 hw;

 - Deleting the timer in function hisi_sas_controller_reset_prepare() which
   is common for v1/v2/v3 hw.

We can remove the timer in the first case, but for the second scenario we
need to remove it only for v3 hw, so check hw->sht which is NULL only for
v3 hw before deleting hisi_hba->timer.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1705904747-62186-5-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bing Xia <xiabing12@h-partners.com>
Signed-off-by: chenyi <chenyi211@huawei.com>
2024-04-24 22:16:20 -04:00