Skip to content

Commit

Permalink
use check_access_perms
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed May 4, 2024
1 parent 0dc5175 commit 9ca168b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion iommu_ref_model/libiommu/include/iommu_translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ msi_address_translation(
uint64_t gpa, uint8_t is_exec, device_context_t *DC,
uint8_t *is_msi, uint8_t *is_mrif, uint32_t *mrif_nid, uint64_t *dest_mrif_addr,
uint32_t *cause, uint64_t *iotval2, uint64_t *pa,
uint64_t *page_sz, gpte_t *g_pte, uint8_t TTYP );
uint64_t *page_sz, gpte_t *g_pte, uint8_t check_access_perms );

#endif // __IOMMU_TRANSLATE_H__
4 changes: 2 additions & 2 deletions iommu_ref_model/libiommu/src/iommu_msi_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ msi_address_translation(
uint64_t gpa, uint8_t is_exec, device_context_t *DC,
uint8_t *is_msi, uint8_t *is_mrif, uint32_t *mrif_nid, uint64_t *dest_mrif_addr,
uint32_t *cause, uint64_t *iotval2, uint64_t *pa,
uint64_t *page_sz, gpte_t *g_pte, uint8_t TTYP ) {
uint64_t *page_sz, gpte_t *g_pte, uint8_t check_access_perms ) {

uint64_t A, m, I;
uint8_t status;
Expand Down Expand Up @@ -170,7 +170,7 @@ msi_address_translation(
// transaction is treated as not requesting supervisor privilege.
// a. If the transaction is a Untranslated or Translated read-for-execute then stop
// and report "Instruction acccess fault" (cause = 1).
if ( is_exec && TTYP != PCIE_ATS_TRANSLATION_REQUEST ) {
if ( is_exec == 1 && check_access_perms == 1 ) {
*cause = 1;
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion iommu_ref_model/libiommu/src/iommu_translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ iommu_translate_iova(
// If a fault is detected by the MSI address translation process then stop and
// report the fault else the process continues at step 20.
if ( msi_address_translation(gpa, is_exec, &DC, &is_msi, &is_mrif, &mrif_nid, &dest_mrif_addr,
&cause, &iotval2, &pa, &gst_page_sz, &g_pte, TTYP) )
&cause, &iotval2, &pa, &gst_page_sz, &g_pte, check_access_perms) )
goto stop_and_report_fault;
if ( is_msi == 1 ) goto skip_gpa_trans;

Expand Down

0 comments on commit 9ca168b

Please sign in to comment.