Lines Matching refs:phc

1806 	struct ena_com_phc_info *phc = &ena_dev->phc;  in ena_com_phc_init()  local
1808 memset(phc, 0x0, sizeof(*phc)); in ena_com_phc_init()
1812 sizeof(*phc->virt_addr), in ena_com_phc_init()
1813 phc->virt_addr, in ena_com_phc_init()
1814 phc->phys_addr, in ena_com_phc_init()
1815 phc->mem_handle); in ena_com_phc_init()
1816 if (unlikely(!phc->virt_addr)) in ena_com_phc_init()
1819 ENA_SPINLOCK_INIT(phc->lock); in ena_com_phc_init()
1821 phc->virt_addr->req_id = 0; in ena_com_phc_init()
1822 phc->virt_addr->timestamp = 0; in ena_com_phc_init()
1829 struct ena_com_phc_info *phc = &ena_dev->phc; in ena_com_phc_config() local
1846 if (get_feat_resp.u.phc.version != ENA_ADMIN_PHC_FEATURE_VERSION_0) { in ena_com_phc_config()
1848 get_feat_resp.u.phc.version, in ena_com_phc_config()
1854 phc->doorbell_offset = get_feat_resp.u.phc.doorbell_offset; in ena_com_phc_config()
1857 phc->expire_timeout_usec = (get_feat_resp.u.phc.expire_timeout_usec) ? in ena_com_phc_config()
1858 get_feat_resp.u.phc.expire_timeout_usec : in ena_com_phc_config()
1862 phc->block_timeout_usec = (get_feat_resp.u.phc.block_timeout_usec) ? in ena_com_phc_config()
1863 get_feat_resp.u.phc.block_timeout_usec : in ena_com_phc_config()
1867 if (phc->expire_timeout_usec > phc->block_timeout_usec) in ena_com_phc_config()
1868 phc->expire_timeout_usec = phc->block_timeout_usec; in ena_com_phc_config()
1874 set_feat_cmd.u.phc.output_length = sizeof(*phc->virt_addr); in ena_com_phc_config()
1875 ret = ena_com_mem_addr_set(ena_dev, &set_feat_cmd.u.phc.output_address, phc->phys_addr); in ena_com_phc_config()
1893 phc->active = true; in ena_com_phc_config()
1901 struct ena_com_phc_info *phc = &ena_dev->phc; in ena_com_phc_destroy() local
1905 if (!phc->virt_addr) in ena_com_phc_destroy()
1908 ENA_SPINLOCK_LOCK(phc->lock, flags); in ena_com_phc_destroy()
1909 phc->active = false; in ena_com_phc_destroy()
1910 ENA_SPINLOCK_UNLOCK(phc->lock, flags); in ena_com_phc_destroy()
1913 sizeof(*phc->virt_addr), in ena_com_phc_destroy()
1914 phc->virt_addr, in ena_com_phc_destroy()
1915 phc->phys_addr, in ena_com_phc_destroy()
1916 phc->mem_handle); in ena_com_phc_destroy()
1917 phc->virt_addr = NULL; in ena_com_phc_destroy()
1919 ENA_SPINLOCK_DESTROY(phc->lock); in ena_com_phc_destroy()
1924 volatile struct ena_admin_phc_resp *read_resp = ena_dev->phc.virt_addr; in ena_com_phc_get_timestamp()
1926 struct ena_com_phc_info *phc = &ena_dev->phc; in ena_com_phc_get_timestamp() local
1932 if (!phc->active) { in ena_com_phc_get_timestamp()
1937 ENA_SPINLOCK_LOCK(phc->lock, flags); in ena_com_phc_get_timestamp()
1940 if (unlikely(ENA_TIME_COMPARE_HIGH_RES(phc->system_time, zero_system_time))) { in ena_com_phc_get_timestamp()
1942 block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time, in ena_com_phc_get_timestamp()
1943 phc->block_timeout_usec); in ena_com_phc_get_timestamp()
1946 phc->stats.phc_skp++; in ena_com_phc_get_timestamp()
1952 if ((READ_ONCE16(read_resp->req_id) != phc->req_id) || in ena_com_phc_get_timestamp()
1957 phc->stats.phc_err++; in ena_com_phc_get_timestamp()
1960 phc->stats.phc_exp++; in ena_com_phc_get_timestamp()
1965 phc->system_time = ENA_GET_SYSTEM_TIME_HIGH_RES(); in ena_com_phc_get_timestamp()
1966 block_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time, phc->block_timeout_usec); in ena_com_phc_get_timestamp()
1967 expire_time = ENA_GET_SYSTEM_TIMEOUT_HIGH_RES(phc->system_time, phc->expire_timeout_usec); in ena_com_phc_get_timestamp()
1970 phc->req_id++; in ena_com_phc_get_timestamp()
1975 read_resp->req_id = phc->req_id + ENA_PHC_REQ_ID_OFFSET; in ena_com_phc_get_timestamp()
1978 ENA_REG_WRITE32(ena_dev->bus, phc->req_id, ena_dev->reg_bar + phc->doorbell_offset); in ena_com_phc_get_timestamp()
1987 phc->error_bound = ENA_PHC_MAX_ERROR_BOUND; in ena_com_phc_get_timestamp()
1993 if (READ_ONCE16(read_resp->req_id) != phc->req_id) { in ena_com_phc_get_timestamp()
2007 phc->error_bound = ENA_PHC_MAX_ERROR_BOUND; in ena_com_phc_get_timestamp()
2016 phc->error_bound = read_resp->error_bound; in ena_com_phc_get_timestamp()
2019 phc->stats.phc_cnt++; in ena_com_phc_get_timestamp()
2022 phc->system_time = zero_system_time; in ena_com_phc_get_timestamp()
2027 ENA_SPINLOCK_UNLOCK(phc->lock, flags); in ena_com_phc_get_timestamp()
2034 struct ena_com_phc_info *phc = &ena_dev->phc; in ena_com_phc_get_error_bound() local
2035 u32 local_error_bound = phc->error_bound; in ena_com_phc_get_error_bound()
2037 if (!phc->active) { in ena_com_phc_get_error_bound()