Commit f6047040 authored by Harald Freudenberger's avatar Harald Freudenberger Committed by Heiko Carstens

s390/ap: exploit new B bit from QCI config info

This patch introduces an update to the ap_config_info
struct which is filled with the QCI subfunction. There
is a new bit apsb (short 'B') showing if the AP secure
bind facility is available. The patch also includes a
simple function ap_sb_available() wrapping this bit test.
Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Reviewed-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: default avatarHolger Dengler <dengler@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 964d581d
...@@ -180,15 +180,16 @@ struct ap_config_info { ...@@ -180,15 +180,16 @@ struct ap_config_info {
unsigned int apxa : 1; /* N bit */ unsigned int apxa : 1; /* N bit */
unsigned int qact : 1; /* C bit */ unsigned int qact : 1; /* C bit */
unsigned int rc8a : 1; /* R bit */ unsigned int rc8a : 1; /* R bit */
unsigned char _reserved1 : 4; unsigned int : 4;
unsigned char _reserved2[3]; unsigned int apsb : 1; /* B bit */
unsigned char Na; /* max # of APs - 1 */ unsigned int : 23;
unsigned char Nd; /* max # of Domains - 1 */ unsigned char na; /* max # of APs - 1 */
unsigned char _reserved3[10]; unsigned char nd; /* max # of Domains - 1 */
unsigned char _reserved0[10];
unsigned int apm[8]; /* AP ID mask */ unsigned int apm[8]; /* AP ID mask */
unsigned int aqm[8]; /* AP (usage) queue mask */ unsigned int aqm[8]; /* AP (usage) queue mask */
unsigned int adm[8]; /* AP (control) domain mask */ unsigned int adm[8]; /* AP (control) domain mask */
unsigned char _reserved4[16]; unsigned char _reserved1[16];
} __aligned(8); } __aligned(8);
/** /**
......
...@@ -200,6 +200,18 @@ static inline int ap_qact_available(void) ...@@ -200,6 +200,18 @@ static inline int ap_qact_available(void)
return 0; return 0;
} }
/*
* ap_sb_available(): Test if the AP secure binding facility is available.
*
* Returns 1 if secure binding facility is available.
*/
int ap_sb_available(void)
{
if (ap_qci_info)
return ap_qci_info->apsb;
return 0;
}
/* /*
* ap_fetch_qci_info(): Fetch cryptographic config info * ap_fetch_qci_info(): Fetch cryptographic config info
* *
...@@ -248,13 +260,13 @@ static void __init ap_init_qci_info(void) ...@@ -248,13 +260,13 @@ static void __init ap_init_qci_info(void)
AP_DBF_INFO("%s successful fetched initial qci info\n", __func__); AP_DBF_INFO("%s successful fetched initial qci info\n", __func__);
if (ap_qci_info->apxa) { if (ap_qci_info->apxa) {
if (ap_qci_info->Na) { if (ap_qci_info->na) {
ap_max_adapter_id = ap_qci_info->Na; ap_max_adapter_id = ap_qci_info->na;
AP_DBF_INFO("%s new ap_max_adapter_id is %d\n", AP_DBF_INFO("%s new ap_max_adapter_id is %d\n",
__func__, ap_max_adapter_id); __func__, ap_max_adapter_id);
} }
if (ap_qci_info->Nd) { if (ap_qci_info->nd) {
ap_max_domain_id = ap_qci_info->Nd; ap_max_domain_id = ap_qci_info->nd;
AP_DBF_INFO("%s new ap_max_domain_id is %d\n", AP_DBF_INFO("%s new ap_max_domain_id is %d\n",
__func__, ap_max_domain_id); __func__, ap_max_domain_id);
} }
......
...@@ -296,6 +296,7 @@ void ap_cancel_message(struct ap_queue *aq, struct ap_message *ap_msg); ...@@ -296,6 +296,7 @@ void ap_cancel_message(struct ap_queue *aq, struct ap_message *ap_msg);
void ap_flush_queue(struct ap_queue *aq); void ap_flush_queue(struct ap_queue *aq);
void *ap_airq_ptr(void); void *ap_airq_ptr(void);
int ap_sb_available(void);
void ap_wait(enum ap_sm_wait wait); void ap_wait(enum ap_sm_wait wait);
void ap_request_timeout(struct timer_list *t); void ap_request_timeout(struct timer_list *t);
void ap_bus_force_rescan(void); void ap_bus_force_rescan(void);
......
...@@ -599,9 +599,9 @@ static int handle_pqap(struct kvm_vcpu *vcpu) ...@@ -599,9 +599,9 @@ static int handle_pqap(struct kvm_vcpu *vcpu)
static void vfio_ap_matrix_init(struct ap_config_info *info, static void vfio_ap_matrix_init(struct ap_config_info *info,
struct ap_matrix *matrix) struct ap_matrix *matrix)
{ {
matrix->apm_max = info->apxa ? info->Na : 63; matrix->apm_max = info->apxa ? info->na : 63;
matrix->aqm_max = info->apxa ? info->Nd : 15; matrix->aqm_max = info->apxa ? info->nd : 15;
matrix->adm_max = info->apxa ? info->Nd : 15; matrix->adm_max = info->apxa ? info->nd : 15;
} }
static void vfio_ap_mdev_update_guest_apcb(struct ap_matrix_mdev *matrix_mdev) static void vfio_ap_mdev_update_guest_apcb(struct ap_matrix_mdev *matrix_mdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment